Advertisement
Guest User

CharacterBody3D Interaction With Rigid Body

a guest
Sep 26th, 2023
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | Software | 0 0
  1. move_and_slide()
  2.  
  3. var inertia = 1
  4. for index in get_slide_collision_count():
  5. var collision = get_slide_collision(index)
  6. var collidingObj = collision.get_collider()
  7. if collidingObj is RigidBody3D:
  8. collidingObj.apply_central_impulse(-1 * collision.get_normal() * inertia * velocity.length())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement