- Home /
Question by
BOOYAHTAMILA · Jul 30, 2021 at 08:45 AM ·
rotationmobilecamera rotate
Mobile , rotate Camera in x,y axis with joystick Help!!
PLS help me. I am working on a fire button with needs to rotate the camera and player if joystick moved in vertical rotate cam in x-axis
if joystick moved in horizontal rotate camera and player in the y axis
Player Rotate and input
void calculateDirection()
{
angle = Mathf.Atan2(input.x, input.y);
angle = Mathf.Rad2Deg * angle;
angle += cam.eulerAngles.y;
}
void Rotate()
{
targetrotation = Quaternion.Euler(0, angle, 0);
transform.rotation = Quaternion.Slerp(transform.rotation, targetrotation, turnspeed * Time.deltaTime);
}
Input to Player rotate
Player.eulerAngles = new Vector3(0, news);
Camera roate
cam.eulerAngles = new Vector3(firePlayer.angle,cam.rotation.y);
What should I do answers will me given credts in my game and live of 100 yrs
Comment
Your answer
Follow this Question
Related Questions
Limit camera RotateAround for an UAV game 0 Answers
Rotate a GameObject in the Vector3 direction? 1 Answer
Make camera move and look at an object over time 0 Answers
How to make the camera follow the player while still being able to be rotated? 1 Answer
How to make the camera return to unitial position when no button are pushed 2 Answers