Hi,
I am working on a 3dgame project, an action game with md2 models.
I m almost done with the movement and the animation of the user-controlled md2 model, and i am trying to create 2 cameras 3p and 1p.
I have set the camera as child of the md2model and for switching between the 2 cameras, I change the position and target. Is this method correct?
My problem is that I cant make the camera turn with the mouse like the CameraSceneNodeFPS.I mean turning the camera with the movement of the mouse and center the camera when the mouse is stopped. Any suggestions?
Thank you
ThirdPerson /FirstPerson camera
why cant you turn the camera?
you just have to change the target of the camera when you move the mouse.
i guess for both tps, and fps camera, you'll just have to rotate your model, if the cam is child of that, then it will turn with it.
but i guess it wont rotate with your model.. coz camera has target, not rotation...
for that you have to write a function what turns like your model turn.
or use this: virtual void bindTargetAndRotation (bool bound)=0
havent try yet though
as for me, i didn't make the cam the child of my model, i updated it manually.
you have more freedom with that
as for changing FPS and TPS, you can make two cameras, and just set the active camera what you want
or, if you think about it, its just changing the camera pos, hiding your model, maybe putting out hands or something.
you should be able to do things like this
i hope that helped xD
you just have to change the target of the camera when you move the mouse.
i guess for both tps, and fps camera, you'll just have to rotate your model, if the cam is child of that, then it will turn with it.
but i guess it wont rotate with your model.. coz camera has target, not rotation...
for that you have to write a function what turns like your model turn.
or use this: virtual void bindTargetAndRotation (bool bound)=0
havent try yet though
as for me, i didn't make the cam the child of my model, i updated it manually.
you have more freedom with that
as for changing FPS and TPS, you can make two cameras, and just set the active camera what you want
or, if you think about it, its just changing the camera pos, hiding your model, maybe putting out hands or something.
you should be able to do things like this
i hope that helped xD
thanks for your answer
I was confused because camera has both rotation and target..
My problem was focused at the FPcamera.
1)After setting the camera as child of the md2model you can only change its target.
2)If using bindTargetAndRotation the target is bind and the rotation can be changed, but when moving my model the camera was changing target automaticly sometimes.... I cant understand exactly why.
The 1st method works but by changing the target I dont get smooth result.
The 2nd method changes the target automaticly sometimes.
I was confused because camera has both rotation and target..
My problem was focused at the FPcamera.
1)After setting the camera as child of the md2model you can only change its target.
2)If using bindTargetAndRotation the target is bind and the rotation can be changed, but when moving my model the camera was changing target automaticly sometimes.... I cant understand exactly why.
The 1st method works but by changing the target I dont get smooth result.
The 2nd method changes the target automaticly sometimes.
I thought about that, but I didint tried it because I believe there might be problems with the collision animators.as for me, i didn't make the cam the child of my model, i updated it manually.
you have more freedom with that Razz
1) changing the target can give smooth result too. you have to change the target to a vector whats before your char.
im using a code like this:
Movevector is this:
25 is the distance from my node, and followNode is just a pointer for the node it following.
you should use instead of followNode->getPosition(), camera->getParent()->getPosition()
2) i didnt try it out, but it should update the target always as the rotation changes.
3) there shouldnt be any problem...
im using a code like this:
Code: Select all
camera->setTarget(followNode->getPosition()+MoveVector(followNode->getRotation(), 25));
Movevector is this:
Code: Select all
vector3df MoveVector(vector3df rotation, f32 distance)
{
vector3df dest = rotation;
vector3df go(distance,0,0);
matrix4 mat;
mat.setRotationDegrees(dest+vector3df(0,90,0));
mat.rotateVect(go);
return go;
}
you should use instead of followNode->getPosition(), camera->getParent()->getPosition()
2) i didnt try it out, but it should update the target always as the rotation changes.
3) there shouldnt be any problem...