Created
February 17, 2026 21:55
-
-
Save Seb105/3e264b34353cdb5439ddcab8b7b937f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ``` | |
| [GlobalClass] | |
| public partial class RigidBody3DStatePassThrough : RigidBody3D { | |
| public PhysicsDirectBodyState3D PhysicsDirectBodyState { get; private set; } = null!; | |
| public new Transform3D GlobalTransform { | |
| get => PhysicsDirectBodyState.Transform; | |
| set => PhysicsDirectBodyState.Transform = value; | |
| } | |
| public new Vector3 LinearVelocity { | |
| get => PhysicsDirectBodyState.LinearVelocity; | |
| set => PhysicsDirectBodyState.LinearVelocity = value; | |
| } | |
| public new Basis GlobalBasis { | |
| get => PhysicsDirectBodyState.Transform.Basis; | |
| set => PhysicsDirectBodyState.Transform = PhysicsDirectBodyState.Transform with { Basis = value }; | |
| } | |
| public new Vector3 AngularVelocity { | |
| get => PhysicsDirectBodyState.AngularVelocity; | |
| set => PhysicsDirectBodyState.AngularVelocity = value; | |
| } | |
| public new Vector3 GlobalPosition { | |
| get => PhysicsDirectBodyState.Transform.Origin; | |
| set => PhysicsDirectBodyState.Transform = PhysicsDirectBodyState.Transform with { Origin = value }; | |
| } | |
| public new void ApplyCentralForce(Vector3 force) => PhysicsDirectBodyState.ApplyCentralForce(force); | |
| public new void ApplyForce(Vector3 force, Vector3? position = null) => | |
| PhysicsDirectBodyState.ApplyForce(force, position); | |
| public new void ApplyTorque(Vector3 torque) => PhysicsDirectBodyState.ApplyTorque(torque); | |
| public new void ApplyTorqueImpulse(Vector3 torque) => PhysicsDirectBodyState.ApplyTorqueImpulse(torque); | |
| public new void ApplyCentralImpulse(Vector3 impulse) => PhysicsDirectBodyState.ApplyCentralImpulse(impulse); | |
| public new void ApplyImpulse(Vector3 impulse, Vector3? position = null) => | |
| PhysicsDirectBodyState.ApplyImpulse(impulse, position); | |
| public new void AddConstantCentralForce(Vector3 force) => PhysicsDirectBodyState.AddConstantCentralForce(force); | |
| public new void AddConstantForce(Vector3 force, Vector3? position = null) => | |
| PhysicsDirectBodyState.AddConstantForce(force, position); | |
| public new void AddConstantTorque(Vector3 torque) => PhysicsDirectBodyState.AddConstantTorque(torque); | |
| public override void _Ready() { | |
| base._Ready(); | |
| PhysicsDirectBodyState = PhysicsServer3D.BodyGetDirectState(GetRid()); | |
| ForceUpdateTransform(); | |
| } | |
| } | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment