classes/class_rigidbody3d #311
Replies: 3 comments 2 replies
-
|
The comment on apply_force for the position property is really misleading, to me it reads as "provide a vector in global space." But after many headaches I have finally realized that it's meant to be a local space coordinate, relative to the bodies origin. |
Beta Was this translation helpful? Give feedback.
-
|
This took me some time to figure out, maybe it helps somebody else:
In hindsight this seems very obvious, because how could it collide with other physics objects if it wasn't moved in |
Beta Was this translation helpful? Give feedback.
-
|
Stolen from the RigidBody2D docs, but incase anybody else needs it for 3D too: func teleport_rigidbody(rigidbody: RigidBody3D, target_transform: Transform3D) -> void:
rigidbody.linear_velocity = Vector3.ZERO
rigidbody.angular_velocity = Vector3.ZERO
rigidbody.global_transform = target_transform
PhysicsServer3D.body_set_state(rigidbody.get_rid(), PhysicsServer3D.BODY_STATE_TRANSFORM, target_transform)
rigidbody.reset_physics_interpolation() |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
classes/class_rigidbody3d
Inherits: PhysicsBody3D< CollisionObject3D< Node3D< Node< Object Inherited By: VehicleBody3D A 3D physics body that is moved by a physics simulation. Description: RigidBody3D implements full 3D phy...
https://docs.godotengine.org/en/latest/classes/class_rigidbody3d.html
Beta Was this translation helpful? Give feedback.
All reactions