I am writing a simple billiards game. I want to detect if an element is moving or it just has stopped. Basically, I want to check if an element has kinematic energy. Is there any method in the engine for checking this?
I am asking because I see that collision shape is changing color in debug mode when my object stops moving.
Yeah - RigidBody->GetLinearVelocity is what I need probably
a) LinearVelocity is a
Vector3, you can use its
Length() as a velocimeter.
b) Alternatively could use
RigidBody::IsActive() in your situation which will return true if either its linear or angular velocity are above their respective thresholds.
c) Welcome to the forums!
Also note that if you don’t actually need the length but a metric to compare against, use Vector3::LengthSquared() to save a call to sqrt()