Using matrices

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.

Using matrices

Postby Zanman777 » Wed May 02, 2012 11:37 pm

Hy,

To put things into context, I'm tryingto make the active camera rotate around the camera target, when the mouse is moved while holding the middle mouse button (just like in so many RTS games).

I never learnt about matrices in school. I did now, through the web, to understand their concept.

I'm still having trouble understanding exactly how matrices are used. Let me see if I got it right. Im my case, I would do something like this:

cpp Code: Select all
 
CMatrix4 m;
m.setRotationCenter (camera->getTarget(), /*what is this translate vector?*/);
m.setRotationDegrees(vector3df(10 * MouseMove.X, 10 * MouseMove.Y, 0)); //where MouseMove is delta position of mouse
m.transformVect (//and then I should get the position + direction vector of the camera);
 


Should the transformed vector be the camera's target?

Or am I doing this all completely wrong?

Please point me in the right direction if I need to learn more about matrices...
Zanman777
 
Posts: 17
Joined: Mon Apr 16, 2012 5:45 pm

Re: Using matrices

Postby hendu » Thu May 03, 2012 7:38 am

You don't really need matrix math for this. The camera already has the constant target, so you can just move the camera position, it keeps looking at the target.
hendu
 
Posts: 1552
Joined: Sat Dec 18, 2010 12:53 pm

Re: Using matrices

Postby Mel » Thu May 03, 2012 7:55 am

But you may want to orbit around the target point. And the Maya camera does that on its own already. WIth the Maya camera, you can:

orbit the target-with the left mouse button
move the camera-with the right mouse button
move along the view direction-with the middle mouse button (or both left and right)
http://santiagong.daportfolio.com/
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
User avatar
Mel
Competition winner
 
Posts: 1783
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain


Return to Beginners Help

Who is online

Users browsing this forum: No registered users and 1 guest

cron