Physics basics: Linear velocity
Linear velocity is the speed of an object in a particular direction. You’ll often hear it described simply as velocity. You can think of it as the distance traveled per unit of time. For example, velocity is commonly measured in miles per hour (mph) or meters per second (m/s).
You can give actors a velocity using these blocks.
The first block gives the actor a velocity in whatever direction it’s currently pointing. The second block gives an actor an absolute velocity, in the x and y directions (that is, in terms of its component x and y values).
Here’s an example of how you could use the set linear velocity block. This is the code for a cannonball:
Here's one last velocity trick. If an object has no velocity, it’s said to be at rest. You can check whether an object is at rest using the is awake? block.
This block returns true or false, depending on whether the actor is moving or not.