Speed of 3D Objects
CreatiCode last edited by info-creaticode
Although you can move an object by setting its x/y/z positions directly, it is strongly recommended that you use the “set speed” block instead.
There are 9 types of speed for you to choose from:
- Forward Speed: this is the distance the object would travel forward every second. The object would only change its X and Y position, and keep the Z position the same. If the speed value is negative, then the object will move backward. By default, the object will move along the positive Y direction, but if it has turned to another direction around the Z axis, then the movement will be along that new direction. In any situation, the object will keep its Z position while moving forward or backward.
- Directional Speed: this is the speed in the current facing direction of the object. This is different from the “Forward Speed” in that the object can change its Z position as well. For example, if we tilt the box up by 45 degrees, then it will move higher when we set its directional speed:
- Side Move Speed: this is the distance the object would travel sideways to the right every second. If the speed value is negative, then the object will move to the left. By default the object will move along the negative X direction, but if it has turned to another direction around the Z axis, then the side move direction will also change. In any situation, the object will keep its Z position while moving sideways.
- Rising Speed: this is the distance the object would rise up in every second. If the speed value is negative, then the object will fall down but it will stop falling when the Z position is 0. This is very handy when you put the ground at Z of 0.
- Forward Acceleration Speed: this is how much the forward speed increases every second. If the value is negative, then the object’s forward speed will decrease. For example, if the forward speed is 100 when we set the forward acceleration speed to -100, then it will take 1 second for the forward speed to drop to 0, then the object will start to move backward.
- Gravity: this is how much the rising speed decreases every second. It has to be 0 or greater. For example, if we set the rising speed to 100 and set gravity to 100, then the rising speed will decrease to 0, then become negative.
- Z Rotation Speed: this is how much the object rotates around the Z-axis every second. If the rotation speed is greater than 0, the object will rotate clockwise looking from the top of the Z-axis; otherwise, it will rotate counter-clockwise. Although you can use the “rotate to” or “turn” blocks to achieve a similar result, it’s recommended that you use the “z-rotation speed”, which saves you from writing repeat loops, and also produces smoother animations.
- X Rotation Speed and Y Rotation Speed: these 2 speeds work in a very similar way as the Z Rotation Speed, except for a different rotation axis.
You can find out the current speed of an object using this block:
This list includes all speed types, and also some other properties.
This is the name of the object you want to check out. If it is left empty, the speed of the current sprite object will be reported.
In case that object is created in another sprite, then you will need to specify the name of that sprite. If it is left empty, the object is assumed to be from the current sprite.