- Home /
Camera follow - rotating rigidbody
The player controls a rigidbody box that is steered by physics (AddForce etc) and I want the camera to follow the player's movement. I used this code on the camera to get it to follow the player without rotating, but now it's stuck "inside" the player.
 using UnityEngine;
 
 public class FollowTransform : MonoBehaviour {
     // Assign in the editor the transform you want to follow;
     public Transform target;
 
     void LateUpdate()
     {
         transform.position = target.position;
     }
 }
I have no idea how to make it "float" above the player to get a good angle. Some help would be appreciated.
Also, pointers to what I could read up on to be able to solve things like these myself in the future would be good.
Answer by Piflik · Jun 30, 2012 at 01:32 PM
Just add any Vector to the position:
 transform.position = target.position + Vector3(X_Offest, Y_Offest, Z_Offest);
Your answer
 
 
             Follow this Question
Related Questions
How to make a camera follow a sphere without rotating with it. 1 Answer
Camera gets flung off of the map when the player collides with certain objects. 0 Answers
Strange problem with cloth 2 Answers
Addforce to ball in camera position 0 Answers
Move a camera with Rigidbody velocity without jitter 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                