Documentation
¶
Overview ¶
Package RayCast3D provides methods for working with RayCast3D object instances.
Index ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Instance
- func (self Instance) AddException(node CollisionObject3D.Instance)
- func (self Instance) AddExceptionRid(rid RID.Body3D)
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRayCast3D() Instance
- func (self Instance) ClearExceptions()
- func (self Instance) CollideWithAreas() bool
- func (self Instance) CollideWithBodies() bool
- func (self Instance) CollisionMask() int
- func (self Instance) DebugShapeCustomColor() Color.RGBA
- func (self Instance) DebugShapeThickness() int
- func (self Instance) Enabled() bool
- func (self Instance) ExcludeParent() bool
- func (self Instance) ForceRaycastUpdate()
- func (self Instance) GetCollider() Object.Instance
- func (self Instance) GetColliderRid() RID.Body3D
- func (self Instance) GetColliderShape() int
- func (self Instance) GetCollisionFaceIndex() int
- func (self Instance) GetCollisionMaskValue(layer_number int) bool
- func (self Instance) GetCollisionNormal() Vector3.XYZ
- func (self Instance) GetCollisionPoint() Vector3.XYZ
- func (self Instance) HitBackFaces() bool
- func (self Instance) HitFromInside() bool
- func (self Instance) ID() ID
- func (self Instance) IsColliding() bool
- func (self Instance) RemoveException(node CollisionObject3D.Instance)
- func (self Instance) RemoveExceptionRid(rid RID.Body3D)
- func (self Instance) SetCollideWithAreas(value bool)
- func (self Instance) SetCollideWithBodies(value bool)
- func (self Instance) SetCollisionMask(value int)
- func (self Instance) SetCollisionMaskValue(layer_number int, value bool)
- func (self Instance) SetDebugShapeCustomColor(value Color.RGBA)
- func (self Instance) SetDebugShapeThickness(value int)
- func (self Instance) SetEnabled(value bool)
- func (self Instance) SetExcludeParent(value bool)
- func (self Instance) SetHitBackFaces(value bool)
- func (self Instance) SetHitFromInside(value bool)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetTargetPosition(value Vector3.XYZ)
- func (self Instance) TargetPosition() Vector3.XYZ
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsRayCast3D ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
A raycast represents a ray from its origin to its [member target_position] that finds the closest object along its path, if it intersects any. [RayCast3D] can ignore some objects by adding them to an exception list, by making its detection reporting ignore [Area3D]s ([member collide_with_areas]) or [PhysicsBody3D]s ([member collide_with_bodies]), or by configuring physics layers. [RayCast3D] calculates intersection every physics frame, and it holds the result until the next physics frame. For an immediate raycast, or if you want to configure a [RayCast3D] multiple times within the same physics frame, use [method force_raycast_update]. To sweep over a region of 3D space, you can approximate the region with multiple [RayCast3D]s or use [ShapeCast3D].
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddException ¶
func (self Instance) AddException(node CollisionObject3D.Instance)
Adds a collision exception so the ray does not report collisions with the specified [CollisionObject3D] node.
func (Instance) AddExceptionRid ¶
Adds a collision exception so the ray does not report collisions with the specified [RID].
func (Instance) AsRayCast3D ¶
func (Instance) ClearExceptions ¶
func (self Instance) ClearExceptions()
Removes all collision exceptions for this ray.
func (Instance) CollideWithAreas ¶
func (Instance) CollideWithBodies ¶
func (Instance) CollisionMask ¶
func (Instance) DebugShapeCustomColor ¶
func (Instance) DebugShapeThickness ¶
func (Instance) ExcludeParent ¶
func (Instance) ForceRaycastUpdate ¶
func (self Instance) ForceRaycastUpdate()
Updates the collision information for the ray immediately, without waiting for the next [code]_physics_process[/code] call. Use this method, for example, when the ray or its parent has changed state. [b]Note:[/b] [member enabled] does not need to be [code]true[/code] for this to work.
func (Instance) GetCollider ¶
Returns the first object that the ray intersects, or [code]null[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]). [b]Note:[/b] This object is not guaranteed to be a [CollisionObject3D]. For example, if the ray intersects a [CSGShape3D] or a [GridMap], the method will return a [CSGShape3D] or [GridMap] instance.
func (Instance) GetColliderRid ¶
Returns the [RID] of the first object that the ray intersects, or an empty [RID] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]).
func (Instance) GetColliderShape ¶
Returns the shape ID of the first object that the ray intersects, or [code]0[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]). To get the intersected shape node, for a [CollisionObject3D] target, use: [codeblocks] [gdscript] var target = get_collider() # A CollisionObject3D. var shape_id = get_collider_shape() # The shape index in the collider. var owner_id = target.shape_find_owner(shape_id) # The owner ID in the collider. var shape = target.shape_owner_get_owner(owner_id) [/gdscript] [csharp] var target = (CollisionObject3D)GetCollider(); // A CollisionObject3D. var shapeId = GetColliderShape(); // The shape index in the collider. var ownerId = target.ShapeFindOwner(shapeId); // The owner ID in the collider. var shape = target.ShapeOwnerGetOwner(ownerId); [/csharp] [/codeblocks]
func (Instance) GetCollisionFaceIndex ¶
Returns the collision object's face index at the collision point, or [code]-1[/code] if the shape intersecting the ray is not a [ConcavePolygonShape3D].
func (Instance) GetCollisionMaskValue ¶
Returns whether or not the specified layer of the [member collision_mask] is enabled, given a [param layer_number] between 1 and 32.
func (Instance) GetCollisionNormal ¶
Returns the normal of the intersecting object's shape at the collision point, or [code]Vector3(0, 0, 0)[/code] if the ray starts inside the shape and [member hit_from_inside] is [code]true[/code]. [b]Note:[/b] Check that [method is_colliding] returns [code]true[/code] before calling this method to ensure the returned normal is valid and up-to-date.
func (Instance) GetCollisionPoint ¶
Returns the collision point at which the ray intersects the closest object, in the global coordinate system. If [member hit_from_inside] is [code]true[/code] and the ray starts inside of a collision shape, this function will return the origin point of the ray. [b]Note:[/b] Check that [method is_colliding] returns [code]true[/code] before calling this method to ensure the returned point is valid and up-to-date.
func (Instance) HitBackFaces ¶
func (Instance) HitFromInside ¶
func (Instance) IsColliding ¶
Returns whether any object is intersecting with the ray's vector (considering the vector length).
func (Instance) RemoveException ¶
func (self Instance) RemoveException(node CollisionObject3D.Instance)
Removes a collision exception so the ray does report collisions with the specified [CollisionObject3D] node.
func (Instance) RemoveExceptionRid ¶
Removes a collision exception so the ray does report collisions with the specified [RID].
func (Instance) SetCollideWithAreas ¶
func (Instance) SetCollideWithBodies ¶
func (Instance) SetCollisionMask ¶
func (Instance) SetCollisionMaskValue ¶
Based on [param value], enables or disables the specified layer in the [member collision_mask], given a [param layer_number] between 1 and 32.