简体   繁体   中英

Opencv Animation Rotation of object using rotation matrix

The project I am working on is about an animation of a car that travels on a grid using xyz coordinates.

The rotation around the z axis was done with a simple rotation matrix using the angle, more accurately atan2(y2-y1,x2-x1), the rotation of the car when taking corners is done but now i need the car to rotate when going up on the z axis and when going down, simulating a slope like a real car would do.

So the problem is that I need 2 rotations in a single matrix, one for steering and one for "climbing" and "going down" a slope. I can't seem to find a good rotation matrix or calculate the right angle for that incline/decline.

Any ideas?

Seems you need lerp and quaternions here, else rotation will look not natural.

You can check simple example here: example BTW, GLM have quaternion math.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM