Hi, i just made a game where the Gamepad can be used. Im using the left Joystick for moving and the right one for rotating the Player and the camera. The camera is a child of the player so it follows up. The horizontal rotating is quite good but the vertical rotating is wrong. The camera has to rotate on the y-Axis of the Player.
At the moment it looks this way:
http://sendvid.com/wdm2ylfx
The camera is able to move but it doesnt focus the Player. But the player has to be always focused. Does someone know how to change my vertical-rotation-script for the right usage?
At the moment it looks this way:
http://sendvid.com/wdm2ylfx
The camera is able to move but it doesnt focus the Player. But the player has to be always focused. Does someone know how to change my vertical-rotation-script for the right usage?
Code:
// camera of the player
public Transform kamera;
// max camrotation vertical
public float maxKameradrehungVertikal = 30.0f;
// min camrotation vertical
public float minKameradrehungVertikal = -30.0f;
// actual camrotation vertical
private float aktuelleKameraDrehungVertikal = 0;
// rotate cam vertical
aktuelleKameraDrehungVertikal = Mathf.Clamp(aktuelleKameraDrehungVertikal + rotationsVektor.y * rotationsGeschwindigkeitVertikal, minKameradrehungVertikal, maxKameradrehungVertikal);
kamera.localRotation = Quaternion.identity;
kamera.Rotate(Vector3.left, aktuelleKameraDrehungVertikal);