Pretty simple question: will the result of b2Body::GetLinearVelocity
tell me if an object is in motion? I would expect that it w开发者_Python百科ould - does it?
GetLinearVelocity()
returns a b2Vec2
. You could use b2Vec2::Length()
to find the magnitude of the velocity; if it is zero, the object is not moving.
It would tell you if the body is moving. However it could also happen to be spinning in one place around the origin and getLinearVelocity()
would return zero. So if you want to be definitely sure that no motion is happening you should check getAngularVelocity()
as well.
精彩评论