UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionRotate the camera on the y-Axis of the player EmptyRotate the camera on the y-Axis of the player

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

descriptionRotate the camera on the y-Axis of the player EmptyRe: Rotate the camera on the y-Axis of the player

more_horiz
Just fixed it by addin an empty GO and made it to the head of the player

descriptionRotate the camera on the y-Axis of the player EmptyRe: Rotate the camera on the y-Axis of the player

more_horiz
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...

descriptionRotate the camera on the y-Axis of the player EmptyRe: Rotate the camera on the y-Axis of the player

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply