Free Rotating Camera?

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.
Post Reply
RageD
Posts: 34
Joined: Mon Jun 13, 2005 2:34 pm

Free Rotating Camera?

Post by RageD »

Hey everyone,

I'm new to Irrlicht, but not to C++. I have checked the tutorials sections (and used google) and cannot find anything to satisfied my needs.

I've been having some issues with my 3rd person camera. I'm working on a short 3rd person action project, but cannot seem to get my mouse handling to work properly. Maybe I'm missing the logic?

Basically, the camera constantly updates based on the position of the player node if no mouse is clicked. However, if the mouse is right-clicked, I'd like to allow a free rotate within a defined radius in real-time.

I am handling most events through an external function which is updated by boolean key clicks. However, I feel this might not be efficient (or possible) to allow real-time camera rotating with the mouse, so I have this part set directly in my event handler (the standard OnEvent derived from IEventReceiver). Perhaps there is a better way to do this?

I have code similar to this in my event handler

Code: Select all

		if(MouseKeys[2] == true)
		{
			scene::ICameraSceneNode* cam = device->getSceneManager()->getActiveCamera();
			if(event.MouseInput.Event == EMIE_MOUSE_MOVED)
			{
				cam->setTarget(core::vector3df((f32)event.MouseInput.X,(f32)-event.MouseInput.Y,(f32)event.MouseInput.X*10));
			}
		}
But, unfortunately, that does not allow me to continue moving the character nor does it really give me the kind of rotation I'm looking for.

Any ideas?

Thanks!

-RageD
DuF = (del)F.u
Microsonic Development
kamikaze942
Posts: 52
Joined: Wed Mar 03, 2010 7:11 pm

Post by kamikaze942 »

how else would you like to rotate the camera? Basically you want your camera set to the target of the player while moving. When not moving you want to rotate the camera to view all the different angles. Using the CameraFPS it already has it setup to move the screen with the mouse, and tethering a character to the camera should be rather easy. Look into adding child/parent to the different nodes.
Kamikaze
Post Reply