How to move the turtle in 3D virtual space
Moving the turtle in the 3D space is essential to the creation of virtual objects and worlds. The turtle is the reference point in the 3D virtual space. Its location (or position) and direction (or orientation) are used to be the location and direction of the object being created.
3D movements involve the change of location and change of direction. These two changes are usually separated. For example, FORWARD 1 will change the location of the turtle, but its direction remains the same. RIGHT 90 will change the direction of the turtle, but its location remains the same.
3D movements in the 3D virtual space of VRMath2 can be classified into three categories (frame of reference) :
The video below explains the first two categories.
There are 8 egocentric movement commands in VRMath2's Logo language. When using these commands, you need to be aware of the turtle's location and direction to correctly expect the movement. They can be put into two groups. All Logo commands are case in-sensitive.
- Change location: these two commands only change the turtle's location but not direction in the 3D virtual space. The distance is specified in METER or CENTIMETER.
- FORWARD distance or FD distance
- BACK distance or BK distance
- Change direction: there are 6 egocentric rotation commands, which change the turtle's orientation but not location. The angle is specified as degrees.
- LEFT angle or LT angle
Note: This animation shows continuing rotation.
- RIGHT angle or RT angle
Note: This animation shows continuing rotation.
- ROLLUP angle or RU angle
Note: This animation shows continuing rotation.
- ROLLDOWN angle or RD angle
Note: This animation shows continuing rotation.
- TILTLEFT angle or TL angle
Note: This animation shows continuing rotation.
- TILTRIGHT angle or TR angle
Note: This animation shows continuing rotation.
Fixed movements are environmental, and are not related to the turtle's direction. There are 7 fixed movement commands in VRMath2's Logo language. All 7 commands will change the turtle's location, and only 1 of the 7 (HOME) will change the direction. In VRMath2's virtual space, the default direction of the turtle is set to be the north direction. From that, east, west, south, up and down can be decided. Fixed movements can be considered as slide, as they (except for HOME) change location but not direction of the turtle.
- EAST distance
- WEST distance
- SOUTH distance
- NORTH distance
- UP distance
- DOWN distance
The above commands need a distance as in meter or centimeter.
- HOME
This command will bring the turtle to the default location (coordinate 0 0 0) and direction (facing north, shell up).
Coordinate/Universal movements
In VRMath2's 3D space, the coordinate system is defined as shown in the image below.
The default turtle direction is facing -z (negative z). Or we can say that x is east, -x is west, y is up, -y is down, z is south, and -z is north.
The commands in this category include:
- SETXYZ x y z
- SETX x
- SETY y
- SETZ z
For other detail movement commands, please refer to the Logo reference/guide section 6.1.
- 3584 reads