O3D_COLLISION()

O3D_COLLISION(N1,N2)

RETURNS 1 IF THE 3D OBJECTS NUMBER N1 AND 2 COLLIDE, 0 OTHERWISE

  • Type: Function
  • Parameter: 1
  • Group: 3D Objects

ACTION

The function O3D_COLLISION(N1,N2) returns 1 if the 3D objects number N1 and N2 collide, 0 otherwise.

SYNTAX: Result=O3D_COLLISION(N1,N2)

  • N1 = 3D object number (integer or real). Must be greater than 0 and less than or equal to the allowed maximum number of 3D objects.
  • N2 = 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 function O3D_COLLISION() is used to know if some 3D objects collide.

ERROR

  • If number N1 is not a correct expression.
  • If number N1 exceeds the allowed maximum number of 3D objects.
  • If number N1 is not greater than 0.
  • If 3D object number N1 does not exist.
  • If number N2 is not a correct expression.
  • If number N2 exceeds the allowed maximum number of 3D objects.
  • If number N2 is not greater than 0.
  • If 3D object number N2 does not exist.

EXAMPLE

label move

scene3D 1:full_space 1

3d_sphere 1,0.5

3d_color 1,0,0,0

3d_position 1,-1.5,0,0

3d_collision_as_sphere 1

3d_sphere 2,0.5

3d_color 2,0,0,0

3d_position 2,0.9,0,0

3d_collision_as_sphere 2

timer 2

timer_interval 2,100

timer_on 2

on_timer 2,bouge

3D_point_object 1,2

end

move:

3d_move 1,0.1

if O3D_collision(1,2)=1

caption 0,"COLLISION"

color 1,0,0,0

3d_color 1,255,255,255

3d_color 2,255,255,255

wait 100

color 1,255,255,255

3d_color 1,0,0,0

3d_color 2,0,0,0

timer_off 2

end_if

return

SEE ALSO

3D_COLLISION_AS_SPHERE

3D_COLLISION_AS_CUBE

3D_COLLISION_AS_ELLIPSOID

3D_COLLISION_AS_POINT

3D_COLLISION_AS_FACES