Skip to content

KX_RaySensor

Base class: SCA_ISensor

A ray sensor detects the first object in a given direction.

The property the ray is looking for.

Type: string

The distance of the ray.

Type: float

Whether or not to look for a material (false = property).

Type: boolean

Whether or not to use XRay.

Type: boolean

The collision mask (16 layers mapped to a 16-bit integer) combined with each object’s collision group, to hit only a subset of the objects in the scene. Only those objects for which collisionGroup & mask is true can be hit.

Type: bitfield

The game object that was hit by the ray. (read-only).

Type: KX_GameObject

The position (in worldcoordinates) where the object was hit by the ray. (read-only).

Type: mathutils.Vector

The normal (in worldcoordinates) of the object at the location where the object was hit by the ray. (read-only).

Type: mathutils.Vector

The material of the object in the face hit by the ray. (read-only).

Type: string

The direction from the ray (in worldcoordinates). (read-only).

Type: mathutils.Vector

The axis the ray is pointing on.

Type: integer from 0 to 5

  • KX_RAY_AXIS_POS_X
  • KX_RAY_AXIS_POS_Y
  • KX_RAY_AXIS_POS_Z
  • KX_RAY_AXIS_NEG_X
  • KX_RAY_AXIS_NEG_Y
  • KX_RAY_AXIS_NEG_Z

These items exist in the engine but were not in the Range documentation. The ones marked new in Anastacio were added by Anastacio Engine.

new in Anastacio attribute

Gaze tolerance (0 to 1): how far off the ray center the target can be.

new in Anastacio attribute · read-only

Fixed gaze progress, from 0 to 1. Reaches 1 after gazeTime seconds looking at the target.

new in Anastacio attribute

Time in seconds looking at the target for the sensor to fire (0 to 30).