Make trail length constant
Hi reader,
I have a trail render component in my 3D object. I want the length of it to be constant, like 3m long, not dependent of time. I tried using a script to set Time to length/speed, but the length changes in acceleration and deceleration.
Any ideas?
Comment
Answer by SkillcraftHD · Sep 09, 2021 at 04:03 PM
Hey there, I've also got the same issue like you, here's the answer I came up with (actually pretty simple): Create a new script and add it to the gameObject:
private void Update()
{
trailRenderer.time = Mathf.Abs(1f / rb.velocity.magnitude);
}
This basically just checks the current speed the rigidbody has and then turns the time around to make if fit the current velocity magnitude. @EBhero