- Home /
Camera follow smoothness problem
Camera is moving too smooth how can i make it to be fast? tried messing around with my smoothTime variable but no success. code:
public var player : GameObject;
var smoothTime = 0.0;
private var yVelocity = 0.0;
function Update ()
{
var newPosition : float = Mathf.SmoothDamp(transform.position.y, player.transform.position.y+7.7f, yVelocity, smoothTime);
transform.position = Vector3(transform.position.x, newPosition, transform.position.z);
}
EDIT: Actually i dont even need smoothness, but i need this because im changing the camera folow position, camera's normal following position is players - 5f but when the player dies i want to change my camera's position to -8f but if I do it with normal camera follow script its changing instantly and its not nice, so i need the camera to shift from -5 to -8.
Answer by Saif_youssef89 · Feb 21, 2016 at 10:09 AM
Try:
var newPosition : float = Mathf.SmoothDamp(transform.position.y, player.transform.position.y+7.7f, yVelocity, smoothTime*Time.deltaTime);
Time.deltaTime tells the code that you want it run in real time not according to FPS (Frames Per Second)...
Sorry, I'm a bit of a noob, but hope this achieves what you're looking for :)
Your answer
Follow this Question
Related Questions
Camera follow a rolling object without looking at it... 0 Answers
Modified SmoothFollow 0 Answers
Smooth Camera help 0 Answers
How to make a camera that follows more than one character? 1 Answer
Smooth camera not really smooth 6 Answers