Rotation

A set of universal blocks that work with Varwin object rotations. You can set up object rotation both in the 3D scene editing mode and in the Blockly logic editor

Inspector

../../../_images/image-616.png

In the scene settings, in the inspector, you can set the rotation of the object on three axes: X, Y and Z

Note

You can learn more about the 3D editor’s interface in the article “Getting to know the interface”

Blockly

Actions

../../../_images/image-153.png
  1. Set rotation X: Y: Z: - instantly sets the rotation of the specified object in degrees on three axes. Rotation is counted relative to world coordinates. Rotation by coordinates
  2. Momentarily rotate by N degrees along the X/Y/Z axis - instantly rotates the object by the specified angle along the selected axis
  3. instantly rotate to Object - instantly rotates the object to another selected object
  4. Instantly rotate as Object - instantly rotates the object to another selected object
  5. Rotate around the X/Y/Z axis at N degrees/sec. - starts rotation of the specified object around the selected local axis with the specified speed
  6. Rotate around the X/Y/Z axis for N sec. at a speed of M degrees/sec. - starts rotation of the object around the selected axis for a specified time with a specified speed
  7. Rotate around the X/Y/Z axis of the object N with speed M degrees/sec. - triggers the rotation of the object around the selected axis of another object with a specified speed
  8. Rotate to object Object with speed N degrees/sec. - triggers object rotation towards another selected object with a specified speed
  9. Rotate the same way as Object with speed N degrees/sec. - triggers object rotation according to parameters of another selected object with the specified speed
  10. Rotate to an angle X: Y: Z: with a speed of N degrees/sec. - starts rotation of the object to an angle in world coordinates specified by a vector with angles on each of the axes within 0-360 degrees

Note

The turn will be made along the shortest path

  1. Rotate around the X/Y/Z axis by N degrees at M degrees/sec. - starts rotation of the object around the selected local axis with a specified speed. Use negative values of velocity to change the direction of rotation

Note

The movement continues until it is stopped by the end of movement block.

Note

To change the direction of movement, use negative velocity values

  1. Stop/stop/continue any rotation - blocks controlling the rotation of the object:
    • End - block parameter that ends any rotation of the object
    • Suspend - block parameter which stops rotation of the object
    • Continue - block parameter that resumes rotation of the object that was paused by the Pause block

Variables

../../../_images/image-231.png
  1. Object is rotating at the moment - returns “true” if the specified object is rotating at the moment. Otherwise it returns “false”
  2. Get rotation angle along X/Y/Z axis from Object - returns the rotation angle of the specified object along the selected axis in world coordinates
  3. Get rotation from Object - returns the rotation of the object in world coordinates as a vector
  4. Execute Object rotation angle along X/Y/Z axis relative to object N - returns object rotation angle relative to another object along selected axis
  5. Execute Object rotation relative to object N - returns object rotation relative to another object as a vector

Events

../../../_images/image-328.png
  1. Completed any rotation for Object - the event is triggered when the specified object completes any rotation. Rotation is considered completed if the object has reached the rotation to the target point, or if the rotation was stopped by the corresponding block
  2. Finished rotation to target object/turned as target object for Object - event is triggered when the object completes rotation to the target object or when the object completes rotation as a target object
  3. Completed turn to target rotation for Object - event is triggered when object completes the turn to target rotation

Examples of use

Rotation by coordinates

Rotation by coordinates is a function that allows you to rotate an object by specifying its rotation angle in the scene space. More information about the position and coordinates of the objects on the stage

Note

Specifying rotation angles in the Blockly editor is equivalent to specifying them in the scene editor in the inspector in the object parameter “Rotation”

Obtaining object data

Let’s look at an example of how some of the blocks in section “Variables” work

../../../_images/image-419.png

To implement the example, we will use a chain whose update is performed all the time. Let’s put a logical condition inside it, which will be fulfilled if the cube doesn’t rotate. If the condition is true, the values of four parameters will be passed to the “Text” object:

../../../_images/image-513.png
  • Returns the rotation angle of the object along the X axis
  • Return the rotation angle of the object along all three axes X, Y, Z
  • Return the rotation angle along the Y axis relative to the specified object, in our case it is the object “Player”
  • Returns the rotation angle along all three axes X, Y, Z relative to the specified object, in our case it is the object “Player”