Opencv Animation Rotation of object using rotation matrix

Question!

The project I am working on is about an animation of a car that travels on a grid using x y z 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?



Answers

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.



Here it seems that your theme is cause this error:

You need to use a Theme.AppCompat theme (or descendant) with the design library..

Try using another theme, Theme.AppCompat.Light or whatever.

Edit: Try this

<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
</style>


android:theme="@style/Theme.AppCompat"

add this in xml file or check what is your App theme in style files and in manifest file which theme you are using ?



This video can help you solving your question :)
By: admin