RayCast3D

package
v0.0.0-...-546f9d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package RayCast3D provides methods for working with RayCast3D object instances.

Index

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 Any

type Any interface {
	gd.IsClass
	AsRayCast3D() Instance
}

type Instance

type Instance [1]gdclass.RayCast3D

A raycast represents a ray from its origin to its [member target_position] that finds the closest [CollisionObject3D] 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 New

func New() Instance

func (Instance) AddException

func (self Instance) AddException(node [1]gdclass.CollisionObject3D)

Adds a collision exception so the ray does not report collisions with the specified [CollisionObject3D] node.

func (Instance) AddExceptionRid

func (self Instance) AddExceptionRid(rid RID.Body3D)

Adds a collision exception so the ray does not report collisions with the specified [RID].

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsNode3D

func (self Instance) AsNode3D() Node3D.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRayCast3D

func (self Instance) AsRayCast3D() Instance

func (Instance) ClearExceptions

func (self Instance) ClearExceptions()

Removes all collision exceptions for this ray.

func (Instance) CollideWithAreas

func (self Instance) CollideWithAreas() bool

func (Instance) CollideWithBodies

func (self Instance) CollideWithBodies() bool

func (Instance) CollisionMask

func (self Instance) CollisionMask() int

func (Instance) DebugShapeCustomColor

func (self Instance) DebugShapeCustomColor() Color.RGBA

func (Instance) DebugShapeThickness

func (self Instance) DebugShapeThickness() int

func (Instance) Enabled

func (self Instance) Enabled() bool

func (Instance) ExcludeParent

func (self Instance) ExcludeParent() bool

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

func (self Instance) GetCollider() Object.Instance

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]).

func (Instance) GetColliderRid

func (self Instance) GetColliderRid() RID.Body3D

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

func (self Instance) GetColliderShape() int

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

func (self Instance) GetCollisionFaceIndex() int

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

func (self Instance) GetCollisionMaskValue(layer_number int) bool

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

func (self Instance) GetCollisionNormal() Vector3.XYZ

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

func (self Instance) GetCollisionPoint() Vector3.XYZ

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 (self Instance) HitBackFaces() bool

func (Instance) HitFromInside

func (self Instance) HitFromInside() bool

func (Instance) IsColliding

func (self Instance) IsColliding() bool

Returns whether any object is intersecting with the ray's vector (considering the vector length).

func (Instance) RemoveException

func (self Instance) RemoveException(node [1]gdclass.CollisionObject3D)

Removes a collision exception so the ray does report collisions with the specified [CollisionObject3D] node.

func (Instance) RemoveExceptionRid

func (self Instance) RemoveExceptionRid(rid RID.Body3D)

Removes a collision exception so the ray does report collisions with the specified [RID].

func (Instance) SetCollideWithAreas

func (self Instance) SetCollideWithAreas(value bool)

func (Instance) SetCollideWithBodies

func (self Instance) SetCollideWithBodies(value bool)

func (Instance) SetCollisionMask

func (self Instance) SetCollisionMask(value int)

func (Instance) SetCollisionMaskValue

func (self Instance) SetCollisionMaskValue(layer_number int, value bool)

Based on [param value], enables or disables the specified layer in the [member collision_mask], given a [param layer_number] between 1 and 32.

func (Instance) SetDebugShapeCustomColor

func (self Instance) SetDebugShapeCustomColor(value Color.RGBA)

func (Instance) SetDebugShapeThickness

func (self Instance) SetDebugShapeThickness(value int)

func (Instance) SetEnabled

func (self Instance) SetEnabled(value bool)

func (Instance) SetExcludeParent

func (self Instance) SetExcludeParent(value bool)

func (Instance) SetHitBackFaces

func (self Instance) SetHitBackFaces(value bool)

func (Instance) SetHitFromInside

func (self Instance) SetHitFromInside(value bool)

func (Instance) SetTargetPosition

func (self Instance) SetTargetPosition(value Vector3.XYZ)

func (Instance) TargetPosition

func (self Instance) TargetPosition() Vector3.XYZ

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL