Hi, this should be easy but I can’t make it work . I’m trying to make the movement of some parented fps weapons less rigid, using the Slerp function. It works well for a while but then my beautiful smoothy movement gets rigid again. Apparently I need to reset the rotation somehow but I haven’t any clue on how to do so.
This is the code I inserted in the Update function:
this.transform.parent = null;
var rotation = Quaternion.Slerp(transform.rotation,GameObject.Find("Player/Main Camera/Weapons").transform.rotation,Time.time*0.01);
transform.rotation = rotation;
you don’t want to use Time.time.
By doing that you are saying “Every frame, move me towards the weapons transform an amount that is directly proportional to the time that the game has been running”
You want to use Time.deltaTime. That says “Every frame, move me towards the weapons transform an amount that is directly proportional to the time that this frame took”
Many thanks for the quick response.
I tried changing Time.time for Time.deltaTime but there is no rotation at all. The transform remains with its original rotation…
Time.deltaTime is much much smaller than Time.time. You will need to change your coefficient to reflect this.
Yep, this was the problem . I increased the coefficient and deltaTime worked as expected. Thanks a lot