- Home /
camera follows player in constant speed even in slow motion
Im working on a game in which the camera follows the player with the help of Vector3.SmoothDamp(). But when i trigger slow motion the camera is way to slow. I want the camera to feel constantly fast even in slow motion.
Mein Code: private float slowmotionFactor= 0.2f; private Vector3 velocityForSmoothDamp;
public void TriggerSlowMotion()
{
Time.timeScale = slowmothionFactor;
Time.fixedDeltaTime = 0.02f * Time.timeScale;
}
private void FixedUpdate()
{
cam.transform.position = Vector3.SmoothDamp(cam.transform.position, player.transform.position, ref velocityForSmoothDamp, 0.01f);
}
Answer by BastianUrbach · Feb 07 at 11:13 PM
SmoothDamp has an optional parameter deltaTime. The default value is Time.deltaTime, which is affected by timeScale. Pass Time.unscaledDeltaTime instead.
Your answer

Follow this Question
Related Questions
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer
Using another editor with Unity - rather than UniSciTE 1 Answer
Expressions in statements must only be executed for their side-effects. 1 Answer
Disabling all renderers in Hierarchy 1 Answer