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); }
public override void DestroyVolume(MyElement element) { if (element.ProxyData == MyElement.PROXY_UNASSIGNED) { return; } m_DAABBTree.RemoveProxy(element.ProxyData); element.ProxyData = MyElement.PROXY_UNASSIGNED; if ((element.Flags & MyElementFlag.EF_SENSOR_ELEMENT) > 0) { MySensorElement se = (MySensorElement)element; } if ((element.Flags & MyElementFlag.EF_RB_ELEMENT) > 0) { MyRBElement elm = (MyRBElement)element; //clear all iterations from me and from objects i iterate with while (elm.GetRBElementInteractions().Count > 0) { MyRBElementInteraction intr = elm.GetRBElementInteractions()[0]; MyPhysics.physicsSystem.GetRBInteractionModule().RemoveRBElementInteraction(intr.RBElement1, intr.RBElement2); } elm.GetRBElementInteractions().Clear(); } }
public override void DestroyVolume(MyElement element) { if (element.ProxyData == MyElement.PROXY_UNASSIGNED) { return; } m_DAABBTree.RemoveProxy(element.ProxyData); element.ProxyData = MyElement.PROXY_UNASSIGNED; if ((element.Flags & MyElementFlag.EF_SENSOR_ELEMENT) > 0) { MySensorElement se = (MySensorElement)element; } if ((element.Flags & MyElementFlag.EF_RB_ELEMENT) > 0) { MyRBElement elm = (MyRBElement)element; //clear all iterations from me and from objects i iterate with while(elm.GetRBElementInteractions().Count > 0){ MyRBElementInteraction intr = elm.GetRBElementInteractions()[0]; MyPhysics.physicsSystem.GetRBInteractionModule().RemoveRBElementInteraction(intr.RBElement1, intr.RBElement2); } elm.GetRBElementInteractions().Clear(); } }
public override void DestroyVolume(MyElement element) { if ((element.Flags & MyElementFlag.EF_SENSOR_ELEMENT) > 0) { return; } MyRBElement elm = (MyRBElement)element; elm.GetRBElementInteractions().Clear(); m_Elements.Remove(elm); }
/// <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); }
public override void CreateVolume(MyElement element) { #if PHYSICS_CHECK for (int i = 0; i < m_Elements.Count; i++) { MyRBElement el = m_Elements[i]; if (el == element) { // inserting twice!!! CommonDebugUtils.AssertRelease(false); return; } } #endif if ((element.Flags & MyElementFlag.EF_SENSOR_ELEMENT) > 0) { return; } MyRBElement elm = (MyRBElement)element; m_Elements.Add(elm); }
/// <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); } }
public virtual void MoveVolumeFast(MyElement element) { }
public virtual void DestroyVolume(MyElement element) { }
public virtual void CreateVolume(MyElement element) { }
/// <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); } }