File tree 1 file changed +5
-0
lines changed
modules/gltf/extensions/physics
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,9 @@ Ref<GLTFPhysicsBody> GLTFPhysicsBody::from_node(const CollisionObject3D *p_body_
112
112
physics_body->linear_velocity = body->get_linear_velocity ();
113
113
physics_body->angular_velocity = body->get_angular_velocity ();
114
114
physics_body->inertia = body->get_inertia ();
115
+ if (body->get_center_of_mass () != Vector3 ()) {
116
+ WARN_PRINT (" GLTFPhysicsBody: This rigid body has a center of mass offset from the origin, which will be ignored when exporting to GLTF." );
117
+ }
115
118
if (cast_to<VehicleBody3D>(p_body_node)) {
116
119
physics_body->body_type = " vehicle" ;
117
120
} else {
@@ -140,6 +143,7 @@ CollisionObject3D *GLTFPhysicsBody::to_node() const {
140
143
body->set_linear_velocity (linear_velocity);
141
144
body->set_angular_velocity (angular_velocity);
142
145
body->set_inertia (inertia);
146
+ body->set_center_of_mass_mode (RigidBody3D::CENTER_OF_MASS_MODE_CUSTOM);
143
147
return body;
144
148
}
145
149
if (body_type == " rigid" ) {
@@ -148,6 +152,7 @@ CollisionObject3D *GLTFPhysicsBody::to_node() const {
148
152
body->set_linear_velocity (linear_velocity);
149
153
body->set_angular_velocity (angular_velocity);
150
154
body->set_inertia (inertia);
155
+ body->set_center_of_mass_mode (RigidBody3D::CENTER_OF_MASS_MODE_CUSTOM);
151
156
return body;
152
157
}
153
158
if (body_type == " static" ) {
You can’t perform that action at this time.
0 commit comments