Rotation Matrix ??

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
marco

Rotation Matrix ??

Post by marco »

hi @all

i'v a problem with the rotation in degrees

if have an up and an dir vector

up is not everytime 0,1,0
dir is the direction

now i rotate dir around up (that works)

but how do i get now the rotation of the object in degrees ?, so that the object rotates to even this dir ???

thx
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

use: matrix4::getRotationDegrees()

you may aply this fixes before using it:

http://irrlicht.sourceforge.net/phpBB2/ ... php?t=2234

http://irrlicht.sourceforge.net/phpBB2/ ... php?t=2458

BTW: howe do you rotate around up vector?
Guest

Post by Guest »

i'll try the fixes

i rotat around th up with :

Code: Select all

dir=
		(dir+
			dir.crossProduct(up.normalize())	*sin(2*PI*rotate/360)).normalize().crossProduct(up.normalize())
			.crossProduct(up.normalize()).normalize()*-1;
that works but how do i now rotate the (for example car) on the screen to reflect these rotations ( up ist die up vector from the street and dir the moving direction) it moves, but the car shows to everywhere , but not to dir ;)
marco

think i did it

Post by marco »

Code: Select all

matrix4 h;
		h.buildCameraLookAtMatrixRH(car->pos,car->pos+car->dir,car->up);
		h.makeInverse();
		car->rotation_angle=h.getRotationDegrees();
		car_object->setRotation(car->rotation_angle);
does exactly what i want

:):):)
Post Reply