public override void CreateVolume(MyElement element) { MyCommonDebugUtils.AssertDebug(element.ProxyData == MyElement.PROXY_UNASSIGNED); BoundingBox aabb = element.GetWorldSpaceAABB(); element.ProxyData = m_DAABBTree.AddProxy(ref aabb, element, (uint)element.Flags); }
/// <summary> /// when a volume moves we have to update the AABB and then update the tree /// </summary> public override void MoveVolume(MyElement element) { if (element.ProxyData == MyElement.PROXY_UNASSIGNED) { return; } element.UpdateAABB(); BoundingBox aabb = element.GetWorldSpaceAABB(); m_DAABBTree.MoveProxy(element.ProxyData, ref aabb, Vector3.Zero); }
/// <summary> /// we have the aabb updated and just update the tree using the info from velocity as a hint /// </summary> public override void MoveVolumeFast(MyElement element) { if (element.ProxyData == MyElement.PROXY_UNASSIGNED) { return; } if ((element.Flags & MyElementFlag.EF_RB_ELEMENT) > 0) { MyRBElement rel = (MyRBElement)element; float dt = MyPhysics.physicsSystem.GetRigidBodyModule().CurrentTimeStep; Vector3 movement = rel.GetRigidBody().LinearVelocity *dt; BoundingBox aabb = element.GetWorldSpaceAABB(); m_DAABBTree.MoveProxy(element.ProxyData, ref aabb, movement); } else { BoundingBox aabb = element.GetWorldSpaceAABB(); m_DAABBTree.MoveProxy(element.ProxyData, ref aabb, Vector3.Zero); } }
/// <summary> /// when a volume moves we have to update the AABB and then update the tree /// </summary> public override void MoveVolume(MyElement element) { if (element.ProxyData == MyElement.PROXY_UNASSIGNED) { return; } element.UpdateAABB(); BoundingBox aabb = element.GetWorldSpaceAABB(); m_DAABBTree.MoveProxy(element.ProxyData,ref aabb, Vector3.Zero); }
/// <summary> /// we have the aabb updated and just update the tree using the info from velocity as a hint /// </summary> public override void MoveVolumeFast(MyElement element) { if (element.ProxyData == MyElement.PROXY_UNASSIGNED) { return; } if ((element.Flags & MyElementFlag.EF_RB_ELEMENT) > 0) { MyRBElement rel = (MyRBElement) element; float dt = MyPhysics.physicsSystem.GetRigidBodyModule().CurrentTimeStep; Vector3 movement = rel.GetRigidBody().LinearVelocity * dt; BoundingBox aabb = element.GetWorldSpaceAABB(); m_DAABBTree.MoveProxy(element.ProxyData, ref aabb, movement); } else { BoundingBox aabb = element.GetWorldSpaceAABB(); m_DAABBTree.MoveProxy(element.ProxyData, ref aabb, Vector3.Zero); } }