Hello,
I would like to rotate my character automatically at the coordinates that the camera is facing at, only in the Y axis, like this :
- Before, I have just rotated my camera (Circle = character, Square = Camera) :
- After, I want to move forward :
Sooo, what can I do please ?
Thanks.
Getting the 3rd person's camera's direction.
Hey guys, thanks for your replies.
Hmm I currently want that cube rotates it's Y axis to the camera's Y axis only when I press the mouse's right button, I am updating the camera's position to get it around the character like this, with the famous sphericalXYZ function :
But I don't really have any idea to get the Camera's Y rotation value to transmit it inside the cube, maybe with the target, I've already tried with getHorizontalAngle, I don't really understand how to use it...
Thanks for your help.
Hmm I currently want that cube rotates it's Y axis to the camera's Y axis only when I press the mouse's right button, I am updating the camera's position to get it around the character like this, with the famous sphericalXYZ function :
Code: Select all
vector3df sphericalXYZ(float compassAngle, float elevationAngle, float radius){
compassAngle = compassAngle * -1;
elevationAngle = elevationAngle * -1;
elevationAngle = elevationAngle + 90;
float x = radius * cos(compassAngle * PI/180.0f ) * sin(elevationAngle * PI/180.0f );
float z = radius * sin(compassAngle * PI/180.0f ) * sin(elevationAngle * PI/180.0f );
float y = radius * cos(elevationAngle * PI/180.0f );
vector3df result;
result.X = x;
result.Y = y;
result.Z = z;
return result;
}
Thanks for your help.