Broken code on page 47?

func tick(dt: NSTimeInterval) { velocity = velocity + acceleration * dt position = position + velocity * dt position.y = max(0, position.y) }

The 2nd and 3rd lines get errors saying "Binary operator “*” cannot be applied to operands of type “Vector” and “NSTimeInterval”

Maybe I overlooked something?

[quote=“rakim87”] func tick(dt: NSTimeInterval) { velocity = velocity + acceleration * dt position = position + velocity * dt position.y = max(0, position.y) }

The 2nd and 3rd lines get errors saying "Binary operator “*” cannot be applied to operands of type “Vector” and “NSTimeInterval”

Maybe I overlooked something?[/quote]

Any answer for that? I have the same problem.

Both acceleration and velocity are of type Vector, but dt is of type scalar (that is, it is of type NSTimeInterval.)
Therefore, you need to overload the binary operator ‘*’ so that it can operate on a vector and a scalar as arguments.