Multiplying a Vector2 by a Scalar (LibGDX)-Collection of common programming errors
I am attempting to multiply the type “Vector2” by a scalar of value delta and type float. Information on the type Vector2 can be found here:
http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/class-use/Vector2.html
Specifically on that page, I am referencing:
Vector2 — Vector2.scl(float scalar) Multiplies this vector by a scalar
position is a Vector2 velocity is a Vector2
I am being given the error: “The method scl(float) is undefined for the type Vector2”
public void update(float delta) {
position.add(velocity.cpy()).scl(delta);
}