- Home /
Question by
TechJunk1e · Mar 13, 2013 at 09:47 AM ·
scaledistance
Object scale based on distance? (Say, a spring.)
How do you make an object's scale change in relation to the distance between it and another object?
I am making a spring in a suspension in a car.
I want it to compress and extend, using its transform and the transform of another object.
Comment
Best Answer
Answer by Fattie · Mar 13, 2013 at 09:49 AM
http://docs.unity3d.com/Documentation/ScriptReference/Transform.html
notice "localScale"
http://docs.unity3d.com/Documentation/ScriptReference/Vector3.Distance.html
notice "Distance"