Physics3D/Physics3DSystem: Don't update sleeping rigid bodies
This commit is contained in:
parent
4ac5fe7cba
commit
fca8c8d01d
|
|
@ -23,9 +23,12 @@ namespace Nz
|
|||
m_physWorld.Step(elapsedTime);
|
||||
|
||||
// Replicate rigid body position to their node components
|
||||
auto velView = registry.view<Nz::NodeComponent, const RigidBody3DComponent>();
|
||||
for (auto [entity, nodeComponent, rigidBodyComponent] : velView.each())
|
||||
auto view = registry.view<Nz::NodeComponent, const RigidBody3DComponent>();
|
||||
for (auto [entity, nodeComponent, rigidBodyComponent] : view.each())
|
||||
{
|
||||
if (rigidBodyComponent.IsSleeping())
|
||||
continue;
|
||||
|
||||
nodeComponent.SetPosition(rigidBodyComponent.GetPosition(), CoordSys::Global);
|
||||
nodeComponent.SetRotation(rigidBodyComponent.GetRotation(), CoordSys::Global);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue