Page 1 of 1

how to modify camera behaviour

Posted: Wed Feb 04, 2009 4:53 pm
by r0d
Hello :)

i will try to make a strategy game with IrrLicth. I already got the model done (i always follow the MVC - Model View Controler - pattern), and the controler will need fiew changes. Neither the audio part won't change very much i guess.

The main work is on the view part: the 3d scene in my case.

I compiled the tutorial 12 (terrain rendering), and it's perfect for what i need. But there's something i don't understand: how to modify the behaviour of the camera.

I undestood that the first step is to intercept the event with an EventReceiver, and return true on OnEvent to avoid others treatments on the event. But i don't understand how to move the camera :oops: The interface ICameraSceneNode don't have member functions such as Rotate() or Move().

Posted: Wed Feb 04, 2009 4:58 pm
by Sylence
You have to implement ICameraSceneNode yourself or use one of the existing cameras of Irrlicht (e.g. the FPS or Maya-style camera)

Posted: Wed Feb 04, 2009 5:11 pm
by rogerborg
[Moved to Beginners' Help]

ICameraSceneNode is derived from ISceneNode, so all of the ISceneNode methods also apply, i.e. setPosition().

Cameras as a bit funny about rotations though. ICameraSceneNode::setTarget() is the most unambiguous method of telling a camera where to look. You can use ISceneNode::setRotation(), if you call ICameraSceneNode::bindTargetAndRotation(true) first (this is the default for FPS cameras).