- Home /
Vector2 does not contain a definition for smoothdamp?
why can't I use this? http://docs.unity3d.com/460/Documentation/ScriptReference/Vector2.SmoothDamp.html
I just get errors. code:
_rigidbody2D.velocity = new Vector2.SmoothDamp(_rigidbody2D.velocity,goalVelo, ref velo, smoothTime);
Answer by Eric5h5 · Nov 21, 2014 at 04:50 PM
That was added in Unity 4.6, as you can see in the history in the docs, so you'd need to be running Unity 4.6 or later.
ahh, ok, thanks!
Where does it say in the docs when a thing was added?
@$$anonymous$$iziziziz: In addition you shouldn't use the "new" keyword as SmoothDamp is a static method:
_rigidbody2D.velocity = Vector2.SmoothDamp(_rigidbody2D.velocity,goalVelo, ref velo, smoothTime);
Oh and here's the hint about the version:
http://docs.unity3d.com/460/Documentation/ScriptReference/Vector2.SmoothDamp.html
/|\
|
This is the current documentation of the latest non beta version:
http://docs.unity3d.com/ScriptReference/Vector2.html
it doesn't contain a SmoothDamp method.
edit
ps: keep in $$anonymous$$d that you can use the Vector3.SmoothDamp but you have to use a vector 3 as velocity since it's a ref parameter. All other variables can be Vector2 since Unity implicitly converts between them. So if you declare your "velo" variable as Vector3 and use Vector3.SmoothDamp it should work as well.
Your answer
Follow this Question
Related Questions
returning a relative Vector? 2 Answers
Get right or left Vector2/3 out of renderer.bounds 0 Answers
Controlling the update position of a cloned Gameobject C# 1 Answer
Pong Game: Vector (0,y) question 0 Answers