- Home /
Question by
arturoza · Jul 11, 2016 at 01:58 PM ·
rotationparenttranslationblock
Parent only Translation (VR)
Hi, I 've parented my camera to a character that moves where I click, I only want my camera to follow it but I don't want to rotate with my character, since the rotation movement is given by the Head of the player,
How could I block the rotation from the parent? Thanks!
Comment
Best Answer
Answer by ScaniX · Jul 11, 2016 at 02:34 PM
I think the best way is to unhook it from the player and use a script like this on the camera:
public GameObject player; // assign player in inspector
public Vector3 offset = new Vector3(0, 0.9f, 0); // offset to the player as the camer is usually a little above it
void LateUpdate() { // "Late" is probably unnecessary, but I want to make sure to get the final coordinates in the frame
gameObject.transform.position = player.transform.position + offset;
}