- Home /
Interpolating the motion of a camera moving from one node to another
I have written a script that moves the camera from one node to another when the player moves into a trigger. It also rotates the camera based on the rotation of the node. However, the camera doesn't actually "move", rather it teleports to the node.
I was trying to see if anyone could help me with making the camera move gradually from position A to the the position of the node and also interpolate the rotation while moving.
Here is the code I have written: (This script is attached to the trigger itself)
var camera1 : Camera;
var node : Transform; var Interpolation = 2;
function OnTriggerEnter (hit : Collider) {
//camera1.enabled = false;
//camera2.enabled = true;
Debug.Log("Camera movement!");
camera1.transform.rotation = (node.transform.rotation);
camera1.transform.position = (node.transform.position);
}
Your answer
Follow this Question
Related Questions
Orient GameObject rotation to rotation of Main Camera 0 Answers
RTS Camera movement wrong after rotation 1 Answer
camera repositions itself 0 Answers