DanielChappuis / reactphysics3d

Open source C++ physics engine library in 3D
http://www.reactphysics3d.com
zlib License
1.54k stars 223 forks source link

Find body linear velocity for point other than COG #128

Closed esppat closed 4 years ago

esppat commented 4 years ago

I wonder if there is a way to find the exact (linear) velocity of a point of a body, point which is not the COG. This because I think the COG of the rotating body is not on the rotation axis (in my particular case, of course). Then, the exact linear velocity of a point of the body cannot be calculated knowing only the local position of the point, the COG position, and the linear and angular velocities (of the COG, I think). I can calculate this velocity by using its position difference between two frames, but I would like to find a better (a more direct) way to calculate this. Any clue? Thanks a lot!

DanielChappuis commented 4 years ago

I am not sure if I really understand your question but if you want to know the linear velocity of any point P on a rigid body, it can be computed with:

V_P = V_C + Vector3.cross(w, CP)

It can be read as the velocity V_P of any point P on a rigid body is the linear velocity V_C of the center of mass C plus the cross product of the angular velocity w of the body and the vector CP from C to P.

Is that what your requested ?

esppat commented 4 years ago

Hi Daniel, No, this is not what I am looking for. In your calculation, you suppose the COG is on the rotation axis. What if it is not the case? Imagine a wheel rolling on the floor: does the linear velocity of the COG plus the angular velocity express exactly the movement of the body in ReactPhysics3d? Thanks a lot for your explanations Patrice

DanielChappuis commented 4 years ago

I am not sure I really understand. When a wheel is rolling on the floor it is rotating around a rotation axis that is going through the center of mass if we consider a perfectly symmetrical wheel isn't it ? And yes it this case, the velocity of any point on the wheel can be expressed with the formula above.

esppat commented 4 years ago

OK, your last sentence is the answer I was looking for! :) Thanks a lot