heron icon indicating copy to clipboard operation
heron copied to clipboard

Allow to apply velocity to any entity (not only dynamic/kinematic bodies)

Open jcornaz opened this issue 5 years ago • 0 comments

A sensor is NOT an actual physics body. But that doesn't mean we don't want to move or rotate it. There are plenty of use-case where we may want to move some sensor without having to make it a "dynamic" body. It would be much easier if I could simply use the velocity component for them.

Thinking about it, the Velocity could work for any entity. And the behavior would be:

  • For dynamic bodies: Apply the velocity, and let rapier continue the simulation (incl. mutating the velocity)
  • For kinematic bodies: Update the next_position at each steap and let rapier continue the simulation (not mutating the velocity)
  • For static bodies and sensors: Teleport the body each frame at the desired velocity ignoring physics rules.
  • For an entity without the Body component: Update the Transform each frame at the desired velocity.

jcornaz avatar Feb 24 '21 15:02 jcornaz