Moving

A set of universal blocks, working with the Varwin objects motion setup. You can adjust the object’s position both in the 3D scene editing mode and in the Blockly logic editor

Inspector

../../../_images/image-713.png

In the scene settings, in the inspector, you can set the position of the object along 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-150.png
  1. Set position X: Y: Z: - instantly moves the specified object to the position set using coordinates in world space Move by coordinates
  2. Move instantly to the center of the object N - instantly moves the specified object by the coordinates of the second object
  3. Move in the direction of the X/Y/Z axis at N m/s - starts the process of moving the specified object in the direction of the selected axis with the specified speed
  4. Move in the direction of the X/Y/Z axis at a distance of N m with a speed of M m/s - starts the process of moving the specified object in the direction of the selected axis for the specified distance with the specified speed
  5. Move in the direction of the X/Y/Z axis for N s at a speed of M m/s - starts the process of moving the specified object in the direction of the selected axis for the specified time at the specified speed
  6. Move to object N with speed M m/s - starts the process of moving the specified object in the direction of the second object with the specified speed
  7. Move to X: Y: Z: coordinates at a speed of N m/s - starts the process of moving the specified object in the direction of the specified coordinates at the specified speed. The movement continues until the object reaches the coordinates
  8. Moves along the route List with speed N - starts the process of moving the specified object along the route with the specified speed. A route is a list of objects or coordinates in the world space, defined by vectors `Move along the route`_

Note

The movement continues until it is stopped by the end of movement block To change the direction of the movement, use a negative velocity value

  1. Close/stop/continue any movement - blocks controlling object movement:
    • End - block parameter, which completes any object movement
    • Suspend - block parameter, which stops object movement
    • Continue - block parameter that resumes object movement, which was paused by the Pause block

Variables

../../../_images/image-229.png
  1. Object is moving at the moment - returns “true” if the specified object is moving at the moment. Otherwise it returns “false”.
  2. Set Object minimum stopping distance in front of the target object N m. - sets the minimum distance between the set and target objects so that the movement to it is considered complete. It calculates the distance between the centers of the objects, so using a value of 0 is not recommended
  3. Set Object face when moving = X: Y: Z: - sets the side the object will face when moving

Note

Value for setting the object to move “face forward”: (x: 0; y: 0; z: 1)

  1. Get from Object position along axis X/Y/Z - returns the position of the specified object along the selected axis in world coordinates
  2. Get from Object position - returns the position of the specified object in world coordinates as a vector [X; Y; Z].
  3. Execute Object object distance - returns the straight line distance from the specified object to the second object
  4. Execute Object object distance to object - returns straight line distance from specified object to world coordinates, specified using vector

Note

The distance is returned in meters as a real number

Events

../../../_images/image-326.png
  1. Completed any move for Object - event is triggered when specified object completes any move

Note

The movement is considered completed if the object has reached the target position, or if the movement has been stopped by the corresponding block

  1. Completed move to target object for Object - the event is triggered when the specified object completes move to the target object
  2. Completed movement to target coordinates for Object - event is triggered when specified object completes movement to target coordinates
  3. Reached a waypoint for Object - event is triggered when the specified object moving along the route reaches the next waypoint

Examples of use

Move by coordinates

Move by coordinates - the function allows you to move an object by specifying for it the necessary global coordinates in the scene space. Detailed information about the position of objects in the scene and their coordinates

Note

Specifying coordinates in the Blockly editor is equivalent to specifying them in the scene editor in the inspector in the object parameter “Position”

Moving along the route

Moving along the route is the creation of a list of objects, which will be the points of the created route for your object

Note

to create a route you usually use the standard point object, because it is not visible in playback mode

../../../_images/image-417.png

Obtaining object data

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

../../../_images/image-512.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 executed if the cube is stationary. If the cube is static, then the values of three parameters will be passed to the “Text” object:

../../../_images/image-615.png
  • Returns object coordinates along the X axis
  • Return coordinates of an object on all three axes X, Y, Z
  • Return the distance from one object to another, in our case it is a cube and a player