- Home /
Vector3.Lerp on a localScale
scale = Vector3(0.1,0,0.1);
aliveArea.transform.localScale += Vector3.Lerp(scale,aliveArea.transform.localScale,Time.deltaTime/100);
I basically trying to increase the objects localScale by the "scale" var's value, I want the object to "smoothly" grow to this size, but this Vector3.Lerp doesn't seemed to smooth ... or have any effect at all.
Any suggestions? Cheers - C
Answer by KeithK · Apr 06, 2011 at 08:56 PM
Dude, you asked this in your previous question to me.
I forgot! there's some extra rep for me being forgetful :D
That link is broken. Here is a working one:
Answer by CJCurrie · Apr 06, 2011 at 08:56 PM
It's because you're incrementing aliveArea rather than assigning to it. Linear interpolation (Lerp) works by returning a value between your start (param 1) and your end (param 2). What you probably meant to do is this:
scale = Vector3(.1,0,.1);
aliveArea.transform.localScale = Vector3.Lerp (aliveArea.Transform.localScale, scale, Time.deltaTime);
This will make aliveArea's localScale move toward scale with a spring-like motion (moves faster the further away it is from the end values).
Your answer
Follow this Question
Related Questions
Problem with Vector3.Lerp 1 Answer
Issues with Lerps 2 Answers
How to smoothly rotate to certain directions using input axis 1 Answer
Vector3 Lerp using Time.deltaTime? 3 Answers
Help here, my code isnt working.. 1 Answer