PhysicsTestMotionParameters3D
Provides parameters for Physics3D.body_test_motion().
Description
Section titled “Description”By changing various properties of this object, such as the motion, you can configure the parameters for Physics3D.body_test_motion().
Properties
Section titled “Properties”| Type | Name | Default |
|---|---|---|
| bool | collide_separation_ray | false |
[]RID | exclude_bodies | [] |
[]int | exclude_objects | [] |
| Transform3D | from | Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) |
| float | margin | 0.001 |
| int | max_collisions | 1 |
| Vector3 | motion | Vector3(0, 0, 0) |
| bool | recovery_as_collision | false |
Property descriptions
Section titled “Property descriptions”collide_separation_ray
Section titled “collide_separation_ray”bool collide_separation_ray = false
Setter/getter: set_collide_separation_ray_enabled(), is_collide_separation_ray_enabled()
If set to true, shapes of type Physics3D.SHAPE_SEPARATION_RAY are used to detect collisions and can stop the motion. Can be useful when snapping to the ground.
If set to false, shapes of type Physics3D.SHAPE_SEPARATION_RAY are only used for separation when overlapping with other bodies. That’s the main use for separation ray shapes.
exclude_bodies
Section titled “exclude_bodies”[]RID exclude_bodies = []
Setter/getter: set_exclude_bodies(), get_exclude_bodies()
Optional array of body RID to exclude from collision. Use CollisionObject3D.get_rid() to get the RID associated with a CollisionObject3D-derived actor.
exclude_objects
Section titled “exclude_objects”[]int exclude_objects = []
Setter/getter: set_exclude_objects(), get_exclude_objects()
Optional array of object unique instance ID to exclude from collision. See Object.get_instance_id().
Transform3D from = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
Setter/getter: set_from(), get_from()
Transform in global space where the motion should start. Usually set to Spatial3D.global_transform for the current body’s transform.
margin
Section titled “margin”float margin = 0.001
Setter/getter: set_margin(), get_margin()
Increases the size of the shapes involved in the collision detection.
max_collisions
Section titled “max_collisions”int max_collisions = 1
Setter/getter: set_max_collisions(), get_max_collisions()
Maximum number of returned collisions, between 1 and 32. Always returns the deepest detected collisions.
motion
Section titled “motion”Vector3 motion = Vector3(0, 0, 0)
Setter/getter: set_motion(), get_motion()
Motion vector to define the length and direction of the motion to test.
recovery_as_collision
Section titled “recovery_as_collision”bool recovery_as_collision = false
Setter/getter: set_recovery_as_collision_enabled(), is_recovery_as_collision_enabled()
If set to true, any depenetration from the recovery phase is reported as a collision; this is used e.g. by CharacterBody3D for improving floor detection during floor snapping.
If set to false, only collisions resulting from the motion are reported, which is generally the desired behavior.