开发者

How to create interactive tracking camera in Ogre3D

How to create camera, that follows player(like in MMORPG games) without the need for translating it every frame. But easy to rotate. If it is possible.

Node character;
Camera camera;

void init() {
   createCharacter();
   /** CREATE CAMERA **/
}

void rotateCamera(float aroundYaxis, float verticaly) {
   /** ROT开发者_如何学运维ATE CAMERA **/
}

void changeDistanceOfCameraToPlayer(float delta/* may be absolute that doesn't matter*/ ) {
   /** MOVE CAMERA **/
}


By default camera isn't attached to any node, so the best way is ti rewrite functions that are responsible for camera movement to translate, yaw and rotate not the camera itself, but some Node, to which you should attach your camera and then attach this node to player. That way if your player moves, the camera will move with it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜