- Home /
How to lock my camera in one direction
So, I'm trying to make a 3d game and i want my camera for my 3th person player to be fixed in one direction. That is probably the best way to discribe it, if you don't fully understand me, my goal is to be like sacred, the game. In the trailer you can see how it's supposed to look: https://www.youtube.com/watch?v=yZ9LY_LVqWU.
By default it should be locked if by script you don’t modify it. By script it will be something like this: transform.position = new Vector3(Player.transform.position.x + offset, offsetFromGround, Player.transform.position.z + offset); Be sure before to rotate right your camera.
Answer by Cutyno · Jun 03, 2018 at 09:40 PM
Hey, if I understand you correctly, you just want to your camera to have one specific rotation. You can do this in more ways:
In your script that moves the camera just use the position of the transform property for example just translate the camera
If you parent your camera to the gameObject you want to follow, you might set up a script that fixes your rotation to a specific direction relativ to the world space
Maybe you don't want to parent your camera to a gameObject but want to follow it anyway. You can do this by simply copy the location of the tracked gameObject and apply it to your camera. The gameObject.Transform.position Property contains a Vector3d which you simply assign to the camera with the same property. The rotation of your camera should be untouched by this approach.
I hope one of the possibilities is suitable for you