I want to create a camera that will follow my vehicle AND change angle if a car turns (I want this camera to be constantly behind the car). I have this fragment of code:
core::vector3df s(0,-100,300); //declaration at the beginning
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS(0,100.0f,1200.f);//camera declaration
and then after while(device->run()) :
const core::vector3df autoPosition = node1->getPosition();
camera->setTarget(autoPosition);
camera->setPosition(autoPosition+s);
where node1 is my car node.This camera follows the car but if a car turns it doesn't rotate to stay behind it. How can I fix it?
camera behind the vehicle
it would be easier just to do
and then the camera will follow the car
-dudMan
Code: Select all
camera->setParent(car);
-dudMan