开发者

How to create interactive tracking camera in Ogre3D

开发者 https://www.devze.com 2023-03-10 07:08 出处:网络
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.

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

精彩评论

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