3D_CHAIN

3D_CHAIN N,P

CHAINS THE 3D OBJECT NUMBER N TO THE 3D OBJECT NUMBER P

  • Type: Command
  • Parameters: 2
  • Group: 3D Objects

ACTION

The command 3D_CHAIN set a hierarchical link between the 3D object designated by its number N and the 3D object designated by its number P : the moves of the 3D object number P are linked to the moves of the 3D object N.

It follows then the translations and rotations of the 3D object number N, but nevertheless, it can have its own moves.

The 3D object number N can be chained to only one 3D object, but several 3D objects can be chained to the same 3D object.

SYNTAX: 3D_CHAIN N,P

  • N = 3D object number (integer or real). Must be greater than 0 and less than or equal to the allowed maximum number of 3D objects.
  • P = 3D object number (integer or real). Must be greater than 0 and less than or equal to the allowed maximum number of 3D objects.

USE

  • The command 3D_CHAIN is used in order that a 3D object follows the moves of another 3D object.

ERROR

  • If number N or number P is not a correct expression.
  • If number N or number P exceeds the allowed maximum number of 3D objects.
  • If number N or number P is not greater than 0.
  • If 3D object number N does not exist.
  • If 3D object number P does not exist.
  • If N=P.
  • If 3D object number N is already chained to another object.

EXAMPLE

rem create a 3D world

scene3d 1

rem give it all the available space

full_space 1

rem create a cube (3D object number 1)

3d_cube 1,1

rem create another cube (3D object number 2)

3d_cube 2,1

rem move this cube

3d_x_position 2,3

rem color it

3d_color 2,200,0,0:wait 1000

rem chain the second cube to the first one

3d_chain 2,1

rem move the SECOND cube ONLY

3d_x_position 2,2.6:wait 1000

rem move the TWO cubes

3d_x_position 1,-2:wait 1000

rem rotate the TWO cubes

3d_z_rotate 1,10:wait 1000

rem break the chain

3d_chain_break 2,1:wait 1000

rem rotate the first cube : the second one is unchanged

3d_z_rotate 1,0

SEE ALSO

3D_CHAIN_BREAK