Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » HELP » Help (General) » Rotate the camera on the y-Axis of the player

Rotate the camera on the y-Axis of the player

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Rotate the camera on the y-Axis of the player on Thu Jun 23, 2016 2:08 pm

Garzec


Member [Lv. 2]
Member [Lv. 2]
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?

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);

View user profile

Garzec


Member [Lv. 2]
Member [Lv. 2]
Just fixed it by addin an empty GO and made it to the head of the player

View user profile

jakeyiii


Member [Lv. 3]
Member [Lv. 3]
Hello

We see that you have some issues with your project/script, however we can help you for a price. If you would like us to work for you then please feel free to contact us at http://RenntekStudios.co.uk or on Skype at RenntekStudios thanks

Our prices are very cheap. Little errors we can fix for free, otherwise projects we can discuss prices. Hope you get in touch shortly thank you...

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum