Area3D

package
v0.0.0-...-e1beaa7 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

graphics.gd/classdb/Area3D is a region of 3D space defined by one or multiple graphics.gd/classdb/CollisionShape3D or graphics.gd/classdb/CollisionPolygon3D child nodes. It detects when other [graphics.gd/classdb/CollisionObject3D]s enter or exit it, and it also keeps track of which collision objects haven't exited it yet (i.e. which one are overlapping it).

This node can also locally alter or override physics parameters (gravity, damping) and route audio to custom audio buses.

Note: Areas and bodies created with graphics.gd/classdb/PhysicsServer3D might not interact as expected with [graphics.gd/classdb/Area3D]s, and might not emit signals or track objects correctly.

Warning: Using a graphics.gd/classdb/ConcavePolygonShape3D inside a graphics.gd/classdb/CollisionShape3D child of this node (created e.g. by using the Create Trimesh Collision Sibling option in the Mesh menu that appears when selecting a graphics.gd/classdb/MeshInstance3D node) may give unexpected results, since this collision shape is hollow. If this is not desired, it has to be split into multiple [graphics.gd/classdb/ConvexPolygonShape3D]s or primitive shapes like graphics.gd/classdb/BoxShape3D, or in some cases it may be replaceable by a graphics.gd/classdb/CollisionPolygon3D.

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
	AsArea3D() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

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

func (self *Extension[T]) AsArea3D() Instance

func (*Extension[T]) AsCollisionObject3D

func (self *Extension[T]) AsCollisionObject3D() CollisionObject3D.Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsNode3D

func (self *Extension[T]) AsNode3D() Node3D.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.Area3D

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AngularDamp

func (self Instance) AngularDamp() Float.X

func (Instance) AngularDampSpaceOverride

func (self Instance) AngularDampSpaceOverride() SpaceOverride

func (Instance) AsArea3D

func (self Instance) AsArea3D() Instance

func (Instance) AsCollisionObject3D

func (self Instance) AsCollisionObject3D() CollisionObject3D.Instance

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) AudioBusName

func (self Instance) AudioBusName() string

func (Instance) AudioBusOverride

func (self Instance) AudioBusOverride() bool

func (Instance) GetOverlappingAreas

func (self Instance) GetOverlappingAreas() []Instance

Returns a list of intersecting [graphics.gd/classdb/Area3D]s. The overlapping area's graphics.gd/classdb/CollisionObject3D.Instance.CollisionLayer must be part of this area's graphics.gd/classdb/CollisionObject3D.Instance.CollisionMask in order to be detected.

For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.

func (Instance) GetOverlappingBodies

func (self Instance) GetOverlappingBodies() []Node3D.Instance

Returns a list of intersecting [graphics.gd/classdb/PhysicsBody3D]s and [graphics.gd/classdb/GridMap]s. The overlapping body's graphics.gd/classdb/CollisionObject3D.Instance.CollisionLayer must be part of this area's graphics.gd/classdb/CollisionObject3D.Instance.CollisionMask in order to be detected.

For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.

func (Instance) Gravity

func (self Instance) Gravity() Float.X

func (Instance) GravityDirection

func (self Instance) GravityDirection() Vector3.XYZ

func (Instance) GravityPoint

func (self Instance) GravityPoint() bool

func (Instance) GravityPointCenter

func (self Instance) GravityPointCenter() Vector3.XYZ

func (Instance) GravityPointUnitDistance

func (self Instance) GravityPointUnitDistance() Float.X

func (Instance) GravitySpaceOverride

func (self Instance) GravitySpaceOverride() SpaceOverride

func (Instance) HasOverlappingAreas

func (self Instance) HasOverlappingAreas() bool

Returns true if intersecting any [graphics.gd/classdb/Area3D]s, otherwise returns false. The overlapping area's graphics.gd/classdb/CollisionObject3D.Instance.CollisionLayer must be part of this area's graphics.gd/classdb/CollisionObject3D.Instance.CollisionMask in order to be detected.

For performance reasons (collisions are all processed at the same time) the list of overlapping areas is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.

func (Instance) HasOverlappingBodies

func (self Instance) HasOverlappingBodies() bool

Returns true if intersecting any [graphics.gd/classdb/PhysicsBody3D]s or [graphics.gd/classdb/GridMap]s, otherwise returns false. The overlapping body's graphics.gd/classdb/CollisionObject3D.Instance.CollisionLayer must be part of this area's graphics.gd/classdb/CollisionObject3D.Instance.CollisionMask in order to be detected.

For performance reasons (collisions are all processed at the same time) the list of overlapping bodies is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) LinearDamp

func (self Instance) LinearDamp() Float.X

func (Instance) LinearDampSpaceOverride

func (self Instance) LinearDampSpaceOverride() SpaceOverride

func (Instance) Monitorable

func (self Instance) Monitorable() bool

func (Instance) Monitoring

func (self Instance) Monitoring() bool

func (Instance) OnAreaEntered

func (self Instance) OnAreaEntered(cb func(area Instance), flags ...Signal.Flags)

func (Instance) OnAreaExited

func (self Instance) OnAreaExited(cb func(area Instance), flags ...Signal.Flags)

func (Instance) OnAreaShapeEntered

func (self Instance) OnAreaShapeEntered(cb func(area_rid RID.Any, area Instance, area_shape_index int, local_shape_index int), flags ...Signal.Flags)

func (Instance) OnAreaShapeExited

func (self Instance) OnAreaShapeExited(cb func(area_rid RID.Any, area Instance, area_shape_index int, local_shape_index int), flags ...Signal.Flags)

func (Instance) OnBodyEntered

func (self Instance) OnBodyEntered(cb func(body Node3D.Instance), flags ...Signal.Flags)

func (Instance) OnBodyExited

func (self Instance) OnBodyExited(cb func(body Node3D.Instance), flags ...Signal.Flags)

func (Instance) OnBodyShapeEntered

func (self Instance) OnBodyShapeEntered(cb func(body_rid RID.Any, body Node3D.Instance, body_shape_index int, local_shape_index int), flags ...Signal.Flags)

func (Instance) OnBodyShapeExited

func (self Instance) OnBodyShapeExited(cb func(body_rid RID.Any, body Node3D.Instance, body_shape_index int, local_shape_index int), flags ...Signal.Flags)

func (Instance) OverlapsArea

func (self Instance) OverlapsArea(area Node.Instance) bool

Returns true if the given graphics.gd/classdb/Area3D intersects or overlaps this graphics.gd/classdb/Area3D, false otherwise.

Note: The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.

func (Instance) OverlapsBody

func (self Instance) OverlapsBody(body Node.Instance) bool

Returns true if the given physics body intersects or overlaps this graphics.gd/classdb/Area3D, false otherwise.

Note: The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.

The 'body' argument can either be a graphics.gd/classdb/PhysicsBody3D or a graphics.gd/classdb/GridMap instance. While GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body.

func (Instance) Priority

func (self Instance) Priority() int

func (Instance) ReverbBusAmount

func (self Instance) ReverbBusAmount() Float.X

func (Instance) ReverbBusEnabled

func (self Instance) ReverbBusEnabled() bool

func (Instance) ReverbBusName

func (self Instance) ReverbBusName() string

func (Instance) ReverbBusUniformity

func (self Instance) ReverbBusUniformity() Float.X

func (Instance) SetAngularDamp

func (self Instance) SetAngularDamp(value Float.X)

func (Instance) SetAngularDampSpaceOverride

func (self Instance) SetAngularDampSpaceOverride(value SpaceOverride)

func (Instance) SetAudioBusName

func (self Instance) SetAudioBusName(value string)

func (Instance) SetAudioBusOverride

func (self Instance) SetAudioBusOverride(value bool)

func (Instance) SetGravity

func (self Instance) SetGravity(value Float.X)

func (Instance) SetGravityDirection

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

func (Instance) SetGravityPoint

func (self Instance) SetGravityPoint(value bool)

func (Instance) SetGravityPointCenter

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

func (Instance) SetGravityPointUnitDistance

func (self Instance) SetGravityPointUnitDistance(value Float.X)

func (Instance) SetGravitySpaceOverride

func (self Instance) SetGravitySpaceOverride(value SpaceOverride)

func (Instance) SetLinearDamp

func (self Instance) SetLinearDamp(value Float.X)

func (Instance) SetLinearDampSpaceOverride

func (self Instance) SetLinearDampSpaceOverride(value SpaceOverride)

func (Instance) SetMonitorable

func (self Instance) SetMonitorable(value bool)

func (Instance) SetMonitoring

func (self Instance) SetMonitoring(value bool)

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetPriority

func (self Instance) SetPriority(value int)

func (Instance) SetReverbBusAmount

func (self Instance) SetReverbBusAmount(value Float.X)

func (Instance) SetReverbBusEnabled

func (self Instance) SetReverbBusEnabled(value bool)

func (Instance) SetReverbBusName

func (self Instance) SetReverbBusName(value string)

func (Instance) SetReverbBusUniformity

func (self Instance) SetReverbBusUniformity(value Float.X)

func (Instance) SetWindAttenuationFactor

func (self Instance) SetWindAttenuationFactor(value Float.X)

func (Instance) SetWindForceMagnitude

func (self Instance) SetWindForceMagnitude(value Float.X)

func (Instance) SetWindSourcePath

func (self Instance) SetWindSourcePath(value string)

func (Instance) Virtual

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

func (Instance) WindAttenuationFactor

func (self Instance) WindAttenuationFactor() Float.X

func (Instance) WindForceMagnitude

func (self Instance) WindForceMagnitude() Float.X

func (Instance) WindSourcePath

func (self Instance) WindSourcePath() string

type SpaceOverride

type SpaceOverride int //gd:Area3D.SpaceOverride
const (
	// This area does not affect gravity/damping.
	SpaceOverrideDisabled SpaceOverride = 0
	// This area adds its gravity/damping values to whatever has been calculated so far (in [Instance.Priority] order).
	SpaceOverrideCombine SpaceOverride = 1
	// This area adds its gravity/damping values to whatever has been calculated so far (in [Instance.Priority] order), ignoring any lower priority areas.
	SpaceOverrideCombineReplace SpaceOverride = 2
	// This area replaces any gravity/damping, even the defaults, ignoring any lower priority areas.
	SpaceOverrideReplace SpaceOverride = 3
	// This area replaces any gravity/damping calculated so far (in [Instance.Priority] order), but keeps calculating the rest of the areas.
	SpaceOverrideReplaceCombine SpaceOverride = 4
)

Jump to

Keyboard shortcuts

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