MeshyRigidPhysicsSettings
Inherits Resource.
Physics settings for generated collision geometry simulated by forces and gravity.
Properties
Section titled “Properties”angular_damp
Section titled “angular_damp”angular_damp: float = 0.0setter: set_angular_damp; getter: get_angular_damp.
Damps the body’s rotation. By default, the body will use the ProjectSettings.physics/3d/default_angular_damp project setting or any value override set by an Area3D the body is in. Depending on angular_damp_mode, you can set angular_damp to be added to or to replace the body’s damping value.
See ProjectSettings.physics/3d/default_angular_damp for more details about damping.
angular_damp_mode
Section titled “angular_damp_mode”angular_damp_mode: int = 0setter: set_angular_damp_mode; getter: get_angular_damp_mode.
Defines how angular_damp is applied.
angular_velocity
Section titled “angular_velocity”angular_velocity: Vector3 = Vector3(0, 0, 0)setter: set_angular_velocity; getter: get_angular_velocity.
The RigidBody3D’s rotational velocity in radians per second.
approximation_tolerance
Section titled “approximation_tolerance”approximation_tolerance: float = 0.02setter: set_approximation_tolerance; getter: get_approximation_tolerance.
The allowed error for convex decomposition, as a dimensionless ratio. Limits relative excess volume and surface deviation divided by the longest bounding-box dimension. A value of 0.02 allows 2% error in each measure.
Lower values require a closer approximation and may require more convex shapes. Generation fails if max_hulls prevents the requested tolerance from being met.
axis_lock_angular_x
Section titled “axis_lock_angular_x”axis_lock_angular_x: bool = falsesetter: set_axis_lock_angular_x; getter: get_axis_lock_angular_x.
Lock the body’s rotation in the X axis.
axis_lock_angular_y
Section titled “axis_lock_angular_y”axis_lock_angular_y: bool = falsesetter: set_axis_lock_angular_y; getter: get_axis_lock_angular_y.
Lock the body’s rotation in the Y axis.
axis_lock_angular_z
Section titled “axis_lock_angular_z”axis_lock_angular_z: bool = falsesetter: set_axis_lock_angular_z; getter: get_axis_lock_angular_z.
Lock the body’s rotation in the Z axis.
axis_lock_linear_x
Section titled “axis_lock_linear_x”axis_lock_linear_x: bool = falsesetter: set_axis_lock_linear_x; getter: get_axis_lock_linear_x.
Lock the body’s linear movement in the X axis.
axis_lock_linear_y
Section titled “axis_lock_linear_y”axis_lock_linear_y: bool = falsesetter: set_axis_lock_linear_y; getter: get_axis_lock_linear_y.
Lock the body’s linear movement in the Y axis.
axis_lock_linear_z
Section titled “axis_lock_linear_z”axis_lock_linear_z: bool = falsesetter: set_axis_lock_linear_z; getter: get_axis_lock_linear_z.
Lock the body’s linear movement in the Z axis.
can_sleep
Section titled “can_sleep”can_sleep: bool = truesetter: set_can_sleep; getter: get_can_sleep.
If true, the body can enter sleep mode when there is no movement. See sleeping.
center_of_mass
Section titled “center_of_mass”center_of_mass: Vector3 = Vector3(0, 0, 0)setter: set_center_of_mass; getter: get_center_of_mass.
The body’s custom center of mass, relative to the body’s origin position, when center_of_mass_mode is set to RigidBody3D.CENTER_OF_MASS_MODE_CUSTOM. This is the balanced point of the body, where applied forces only cause linear acceleration. Applying forces outside of the center of mass causes angular acceleration.
When center_of_mass_mode is set to RigidBody3D.CENTER_OF_MASS_MODE_AUTO (default value), the center of mass is automatically determined, but this does not update the value of center_of_mass.
center_of_mass_mode
Section titled “center_of_mass_mode”center_of_mass_mode: int = 0setter: set_center_of_mass_mode; getter: get_center_of_mass_mode.
Defines the way the body’s center of mass is set.
collision_layer
Section titled “collision_layer”collision_layer: int = 1setter: set_collision_layer; getter: get_collision_layer.
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.
collision_mask
Section titled “collision_mask”collision_mask: int = 1setter: set_collision_mask; getter: get_collision_mask.
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.
collision_priority
Section titled “collision_priority”collision_priority: float = 1.0setter: set_collision_priority; getter: get_collision_priority.
The priority used to solve colliding when occurring penetration. The higher the priority is, the lower the penetration into the object will be. This can for example be used to prevent the player from breaking through the boundaries of a level.
contact_monitor
Section titled “contact_monitor”contact_monitor: bool = falsesetter: set_contact_monitor; getter: get_contact_monitor.
If true, the RigidBody3D will emit signals when it collides with another body.
Note: By default the maximum contacts reported is set to 0, meaning nothing will be recorded, see max_contacts_reported.
continuous_cd
Section titled “continuous_cd”continuous_cd: bool = falsesetter: set_continuous_cd; getter: get_continuous_cd.
If true, continuous collision detection is used.
Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided. Continuous collision detection is more precise, and misses fewer impacts by small, fast-moving objects. Not using continuous collision detection is faster to compute, but can miss small, fast-moving objects.
custom_integrator
Section titled “custom_integrator”custom_integrator: bool = falsesetter: set_custom_integrator; getter: get_custom_integrator.
If true, the standard force integration (like gravity or damping) will be disabled for this body. Other than collision response, the body will only move as determined by the RigidBody3D._integrate_forces method, if that virtual method is overridden.
Setting this property will call the method PhysicsServer3D.body_set_omit_force_integration internally.
debug_color
Section titled “debug_color”debug_color: Color = Color(0, 0.6, 0.7, 0.42)setter: set_debug_color; getter: get_debug_color.
The collision shape color that is displayed in the editor, or in the running project if Debug > Visible Collision Shapes is checked at the top of the editor.
Note: The default value is ProjectSettings.debug/shapes/collision/shape_color. The Color(0, 0, 0, 0) value documented here is a placeholder, and not the actual default debug color.
debug_fill
Section titled “debug_fill”debug_fill: bool = truesetter: set_debug_fill; getter: get_debug_fill.
If true, when the shape is displayed, it will show a solid fill color in addition to its wireframe.
freeze
Section titled “freeze”freeze: bool = falsesetter: set_freeze; getter: get_freeze.
If true, the body is frozen. Gravity and forces are not applied anymore.
See freeze_mode to set the body’s behavior when frozen.
Note: For a body that is always frozen, use StaticBody3D or AnimatableBody3D instead.
freeze_mode
Section titled “freeze_mode”freeze_mode: int = 0setter: set_freeze_mode; getter: get_freeze_mode.
The body’s freeze mode. Determines the body’s behavior when freeze is true.
Note: For a body that is always frozen, use StaticBody3D or AnimatableBody3D instead.
gravity_scale
Section titled “gravity_scale”gravity_scale: float = 1.0setter: set_gravity_scale; getter: get_gravity_scale.
This is multiplied by ProjectSettings.physics/3d/default_gravity to produce this body’s gravity. For example, a value of 1.0 will apply normal gravity, 2.0 will apply double the gravity, and 0.5 will apply half the gravity to this body.
inertia
Section titled “inertia”inertia: Vector3 = Vector3(0, 0, 0)setter: set_inertia; getter: get_inertia.
The body’s moment of inertia. This is like mass, but for rotation: it determines how much torque it takes to rotate the body on each axis. The moment of inertia is usually computed automatically from the mass and the shapes, but this property allows you to set a custom value.
If set to Vector3.ZERO, inertia is automatically computed (default value).
Note: This value does not change when inertia is automatically computed. Use PhysicsServer3D to get the computed inertia.
@onready var ball = $Ball
func get_ball_inertia(): return PhysicsServer3D.body_get_direct_state(ball.get_rid()).inverse_inertia.inverse()private RigidBody3D _ball;
public override void _Ready(){ _ball = GetNode<RigidBody3D>("Ball");}
private Vector3 GetBallInertia(){ return PhysicsServer3D.BodyGetDirectState(_ball.GetRid()).InverseInertia.Inverse();}linear_damp
Section titled “linear_damp”linear_damp: float = 0.0setter: set_linear_damp; getter: get_linear_damp.
Damps the body’s movement. By default, the body will use the ProjectSettings.physics/3d/default_linear_damp project setting or any value override set by an Area3D the body is in. Depending on linear_damp_mode, you can set linear_damp to be added to or to replace the body’s damping value.
See ProjectSettings.physics/3d/default_linear_damp for more details about damping.
linear_damp_mode
Section titled “linear_damp_mode”linear_damp_mode: int = 0setter: set_linear_damp_mode; getter: get_linear_damp_mode.
Defines how linear_damp is applied.
linear_velocity
Section titled “linear_velocity”linear_velocity: Vector3 = Vector3(0, 0, 0)setter: set_linear_velocity; getter: get_linear_velocity.
The body’s linear velocity in units per second. Can be used sporadically, but don’t set this every frame, because physics may run in another thread and runs at a different granularity. Use RigidBody3D._integrate_forces as your process loop for precise control of the body state.
lock_rotation
Section titled “lock_rotation”lock_rotation: bool = falsesetter: set_lock_rotation; getter: get_lock_rotation.
If true, the body cannot rotate. Gravity and forces only apply linear movement.
mass: float = 1.0setter: set_mass; getter: get_mass.
The body’s mass.
max_contacts_reported
Section titled “max_contacts_reported”max_contacts_reported: int = 0setter: set_max_contacts_reported; getter: get_max_contacts_reported.
The maximum number of contacts that will be recorded. Requires a value greater than 0 and contact_monitor to be set to true to start to register contacts. Use RigidBody3D.get_contact_count to retrieve the count or RigidBody3D.get_colliding_bodies to retrieve bodies that have been collided with.
Note: The number of contacts is different from the number of collisions. Collisions between parallel edges will result in two contacts (one at each end), and collisions between parallel faces will result in four contacts (one at each corner).
max_hulls
Section titled “max_hulls”max_hulls: int = 32setter: set_max_hulls; getter: get_max_hulls.
The maximum number of convex shapes generated by Convex - Multiple, including when shape_mode selects it through Auto. Accepted values range from 1 to 256.
A higher limit can preserve more detail at a higher physics cost. If this limit prevents generation from meeting approximation_tolerance, generation fails and no live collider is created.
physics_material_override
Section titled “physics_material_override”physics_material_override: PhysicsMaterial = nullsetter: set_physics_material_override; getter: get_physics_material_override.
The physics material override for the body.
If a material is assigned to this property, it will be used instead of any other physics material, such as an inherited one.
resource_local_to_scene
Section titled “resource_local_to_scene”resource_local_to_scene: bool = truesetter: set_local_to_scene; getter: is_local_to_scene.
shape_mode
Section titled “shape_mode”shape_mode: int = 0setter: set_shape_mode; getter: get_shape_mode.
Selects the collision shapes generated from the mesh.
Auto uses one convex hull for convex geometry. Otherwise, it approximates a closed solid with multiple convex shapes.
Concave is available only for static and animatable bodies. Convex - Single uses one convex shape and fills openings and cavities. Convex - Multiple approximates a closed solid with multiple convex shapes.
sleeping
Section titled “sleeping”sleeping: bool = falsesetter: set_sleeping; getter: get_sleeping.
If true, the body will not move and will not calculate forces until woken up by another body through, for example, a collision, or by using the RigidBody3D.apply_impulse or RigidBody3D.apply_force methods.
Methods
Section titled “Methods”generation_identity
Section titled “generation_identity”generation_identity() -> Stringqualifiers: const.
get_mode
Section titled “get_mode”get_mode() -> intqualifiers: const.
material_changed
Section titled “material_changed”material_changed() -> void