bevy_xpbd icon indicating copy to clipboard operation
bevy_xpbd copied to clipboard

get point velocity: total force including rotational force

Open johannesvollmer opened this issue 1 year ago • 0 comments
trafficstars

Hi! I'm using a little utility function to get the point velocity, which I couldn't find in the library. Maybe this exists but I couldn't find it? I propose it would be a good addition to the library, as this is basically the "getter" counterpart to apply_force_at_point.

The implementation is pretty straight forward:

fn linear_velocity_at_point_from_angular_velocity(angular_velocity: Vec3, point: Vec3, center_of_mass: Vec3) -> Vec3 {
    let radius_vec = point - center_of_mass;
    angular_velocity.cross(radius_vec)
}

But what about the Torque component, that exists in addition to the LinearVelocity.torque field, must it be taken into account aswell?

How are they related? Will they be the same at all times?

johannesvollmer avatar Jul 15 '24 10:07 johannesvollmer