Merge branch 'master' into physics3d-material

This commit is contained in:
Lynix
2018-01-14 18:05:44 +01:00
3 changed files with 54 additions and 40 deletions

View File

@@ -60,6 +60,18 @@ namespace Ndk
{
m_dynamicObjects.Remove(entity);
m_staticObjects.Insert(entity);
// If entities just got added to the system, teleport them to their NodeComponent position/rotation
// This will prevent the physics engine to mess with the scene while correcting position/rotation
if (justAdded)
{
auto& collision = entity->GetComponent<CollisionComponent3D>();
auto& node = entity->GetComponent<NodeComponent>();
Nz::RigidBody3D* physObj = collision.GetStaticBody();
physObj->SetPosition(node.GetPosition());
physObj->SetRotation(node.GetRotation());
}
}
if (!m_world)