- Home /
Question by
ThanksTnx · Aug 08, 2017 at 04:40 AM ·
rigidbodyinstantiatescale
Slowly scale object to original size on instantiate
public class Summon : MonoBehaviour
{
public Transform obj;
void Start()
{
Instantiate(prefab, new Vector3(0, 0, 0), Quaternion.identity);
//obj.localScale += new Vector3(0.1F, 0, 0);
}
}
Once an object is created I want them to start small and then grow to its desired size. How do I do this? Thanks.
Comment
How do I do that? I want it to start smaller then go back to its original size.
@ThanksTnx you can use Lerp to do so,
void Update()
{
if (lerpControl < 1)
{
lerpControl += Time.deltaTime / lerpControl;
scale = $$anonymous$$athf.Lerp(originScale, targetScale, lerpControl));
}
}
}
Something like that