Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 2 (modified by landauf, 17 years ago) (diff)

Howto Scriptable Camera

This is an archived page!
This page is very old and the content is not up to date.
Not everything (if any) which is written here will be in the final game!

To use it, just use the CameraMan class. The basic principle is that the camera is always attached to something.

There are two different attach modes:

  • attaching it to a world entity

and that's it! The camera follows it.

  • attaching it to a virtual pnode

This mode is used to move the camera independently. Internal it's done by moving the virtual pnode.

To attach the cam to a pnode use

attach(pnode*)

To detach the cam (that means to attach it to the virtual pnode) use

detach().

The CameraMan helps you to manage your cameras. Every method with the key word Curr in its name will apply the change on the current cam ;)

If you want to apply some changes on an inactive camera just forget the Curr key word and put instead the number of the cam you wish to modify into the argument of the method you're using.

Example:

If you want to tell the current camera to look at a specific pnode you'll just have to use

changeCurrTarget(pnode*)

You can change the target of any camera. just put the camera number into the method's argument.

changeTarget(Pnode*, cameraNumber)

Note: The camera numbers are given in the order of creating it. The first camera which is attached to the playable by default is number 0. Nothing should happen if you try to use a camera number which doesn't exists ;)

There are more nice methods in the CameraMan class. For example to create a new cam, set a cam as the current cam etc.

http://doc.orxonox.net for more information or cameraman.h