PhysicalBone3D

继承: PhysicsBody3D < CollisionObject3D < Node3D < Node < Object

A physics body used to make bones in a Skeleton3D react to physics.

描述

The PhysicalBone3D node is a physics body that can be used to make bones in a Skeleton3D react to physics.

Note: In order to detect physical bones with raycasts, the SkeletonModifier3D.active property of the parent PhysicalBoneSimulator3D must be true and the Skeleton3D's bone must be assigned to PhysicalBone3D correctly; it means that get_bone_id should return a valid id (>= 0).

属性

方法

void_integrate_forces ( state: PhysicsDirectBodyState3D ) virtual1
voidapply_central_impulse ( impulse: Vector3 )
voidapply_impulse ( impulse: Vector3, position: Vector3 = Vector3(0, 0, 0) )
intget_bone_id ( ) const2
boolget_simulate_physics ( )
boolis_simulating_physics ( )

枚举

enum DampMode:

DampMode DAMP_MODE_COMBINE = 0

In this mode, the body's damping value is added to any value set in areas or the default value.

DampMode DAMP_MODE_REPLACE = 1

In this mode, the body's damping value replaces any value set in areas or the default value.


enum JointType:

JointType JOINT_TYPE_NONE = 0

该枚举目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!

JointType JOINT_TYPE_PIN = 1

该枚举目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!

JointType JOINT_TYPE_CONE = 2

该枚举目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!

JointType JOINT_TYPE_HINGE = 3

该枚举目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!

JointType JOINT_TYPE_SLIDER = 4

该枚举目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!

JointType JOINT_TYPE_6DOF = 5

该枚举目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!


属性说明

float angular_damp = 0.0

  • void set_angular_damp ( value: float )
  • float get_angular_damp ( )

Damps the body's rotation. By default, the body will use the Default Angular Damp in Project > Project Settings > Physics > 3d 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.


DampMode angular_damp_mode = 0

  • void set_angular_damp_mode ( value: DampMode )
  • DampMode get_angular_damp_mode ( )

Defines how angular_damp is applied. See DampMode for possible values.


Vector3 angular_velocity = Vector3(0, 0, 0)

  • void set_angular_velocity ( value: Vector3 )
  • Vector3 get_angular_velocity ( )

The PhysicalBone3D's rotational velocity in radians per second.


Transform3D body_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)

Sets the body's transform.


float bounce = 0.0

  • void set_bounce ( value: float )
  • float get_bounce ( )

The body's bounciness. Values range from 0 (no bounce) to 1 (full bounciness).

Note: Even with bounce set to 1.0, some energy will be lost over time due to linear and angular damping. To have a PhysicalBone3D that preserves all its energy over time, set bounce to 1.0, linear_damp_mode to DAMP_MODE_REPLACE, linear_damp to 0.0, angular_damp_mode to DAMP_MODE_REPLACE, and angular_damp to 0.0.


bool can_sleep = true

  • void set_can_sleep ( value: bool )
  • bool is_able_to_sleep ( )

If true, the body is deactivated when there is no movement, so it will not take part in the simulation until it is awakened by an external force.


bool custom_integrator = false

  • void set_use_custom_integrator ( value: bool )
  • bool is_using_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 _integrate_forces method, if that virtual method is overridden.

Setting this property will call the method PhysicsServer3D.body_set_omit_force_integration internally.


float friction = 1.0

  • void set_friction ( value: float )
  • float get_friction ( )

The body's friction, from 0 (frictionless) to 1 (max friction).


float gravity_scale = 1.0

  • void set_gravity_scale ( value: float )
  • float get_gravity_scale ( )

This is multiplied by the global 3D gravity setting found in Project > Project Settings > Physics > 3d to produce the body's gravity. For example, a value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object.


Transform3D joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)

Sets the joint's transform.


Vector3 joint_rotation = Vector3(0, 0, 0)

  • void set_joint_rotation ( value: Vector3 )
  • Vector3 get_joint_rotation ( )

Sets the joint's rotation in radians.


JointType joint_type = 0

Sets the joint type. See JointType for possible values.


float linear_damp = 0.0

  • void set_linear_damp ( value: float )
  • float get_linear_damp ( )

Damps the body's movement. By default, the body will use the Default Linear Damp in Project > Project Settings > Physics > 3d 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.


DampMode linear_damp_mode = 0

  • void set_linear_damp_mode ( value: DampMode )
  • DampMode get_linear_damp_mode ( )

Defines how linear_damp is applied. See DampMode for possible values.


Vector3 linear_velocity = Vector3(0, 0, 0)

  • void set_linear_velocity ( value: Vector3 )
  • Vector3 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 _integrate_forces as your process loop for precise control of the body state.


float mass = 1.0

  • void set_mass ( value: float )
  • float get_mass ( )

The body's mass.


方法说明

void _integrate_forces ( state: PhysicsDirectBodyState3D ) virtual1

Called during physics processing, allowing you to read and safely modify the simulation state for the object. By default, it is called before the standard force integration, but the custom_integrator property allows you to disable the standard force integration and do fully custom force integration for a body.


void apply_central_impulse ( impulse: Vector3 )

该方法目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!


void apply_impulse ( impulse: Vector3, position: Vector3 = Vector3(0, 0, 0) )

该方法目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!


int get_bone_id ( ) const2

该方法目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!


bool get_simulate_physics ( )

该方法目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!


bool is_simulating_physics ( )

该方法目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!

1

本方法通常需要用户覆盖才能生效。

2

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。