Up to date
This page is up to date for Godot 4.2
.
If you still find outdated information, please open an issue.
CollisionObject3D¶
Inherits: Node3D < Node < Object
Inherited By: Area3D, PhysicsBody3D
Abstract base class for 3D physics objects.
Description¶
Abstract base class for 3D physics objects. CollisionObject3D can hold any number of Shape3Ds for collision. Each shape must be assigned to a shape owner. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the shape_owner_*
methods.
Warning: With a non-uniform scale, this node will likely not behave as expected. It is advised to keep its scale the same on all axes and adjust its collision shape(s) instead.
Properties¶
|
||
|
||
|
||
|
||
|
||
|
Methods¶
Signals¶
input_event ( Node camera, InputEvent event, Vector3 position, Vector3 normal, int shape_idx )
Emitted when the object receives an unhandled InputEvent. position
is the location in world space of the mouse pointer on the surface of the shape with index shape_idx
and normal
is the normal vector of the surface at that point.
mouse_entered ( )
Emitted when the mouse pointer enters any of this object's shapes. Requires input_ray_pickable to be true
and at least one collision_layer bit to be set.
Note: Due to the lack of continuous collision detection, this signal may not be emitted in the expected order if the mouse moves fast enough and the CollisionObject3D's area is small. This signal may also not be emitted if another CollisionObject3D is overlapping the CollisionObject3D in question.
mouse_exited ( )
Emitted when the mouse pointer exits all this object's shapes. Requires input_ray_pickable to be true
and at least one collision_layer bit to be set.
Note: Due to the lack of continuous collision detection, this signal may not be emitted in the expected order if the mouse moves fast enough and the CollisionObject3D's area is small. This signal may also not be emitted if another CollisionObject3D is overlapping the CollisionObject3D in question.
Enumerations¶
enum DisableMode:
DisableMode DISABLE_MODE_REMOVE = 0
When Node.process_mode is set to Node.PROCESS_MODE_DISABLED, remove from the physics simulation to stop all physics interactions with this CollisionObject3D.
Automatically re-added to the physics simulation when the Node is processed again.
DisableMode DISABLE_MODE_MAKE_STATIC = 1
When Node.process_mode is set to Node.PROCESS_MODE_DISABLED, make the body static. Doesn't affect Area3D. PhysicsBody3D can't be affected by forces or other bodies while static.
Automatically set PhysicsBody3D back to its original mode when the Node is processed again.
DisableMode DISABLE_MODE_KEEP_ACTIVE = 2
When Node.process_mode is set to Node.PROCESS_MODE_DISABLED, do not affect the physics simulation.
Property Descriptions¶
int collision_layer = 1
The physics layers this CollisionObject3D is in. Collision objects can exist in one or more of 32 different layers. See also collision_mask.
Note: Object A can detect a contact with object B only if object B is in any of the layers that object A scans. See Collision layers and masks in the documentation for more information.
int collision_mask = 1
The physics layers this CollisionObject3D scans. Collision objects can scan one or more of 32 different layers. See also collision_layer.
Note: Object A can detect a contact with object B only if object B is in any of the layers that object A scans. See Collision layers and masks in the documentation for more information.
float collision_priority