internal bool Synchronize(BroadPhase broadPhase, Transform Transform1, Transform Transform2) { if (_proxyId == PairManager.NullProxy) { return(false); } // Compute an AABB that covers the swept shape (may miss some rotation effect). AABB aabb1, aabb2; _shape.ComputeAABB(out aabb1, Transform1); _shape.ComputeAABB(out aabb2, Transform2); AABB aabb = new AABB(); aabb.Combine(aabb1, aabb2); if (broadPhase.InRange(aabb)) { broadPhase.MoveProxy(_proxyId, aabb); return(true); } else { return(false); } }
/// <summary> /// Describes whether this instance synchronize /// </summary> /// <param name="broadPhase">The broad phase</param> /// <param name="transform1">The transform</param> /// <param name="transform2">The transform</param> /// <returns>The bool</returns> internal bool Synchronize(BroadPhase broadPhase, XForm transform1, XForm transform2) { if (ProxyId == PairManager.NullProxy) { return(false); } // Compute an AABB that covers the swept shape (may miss some rotation effect). Aabb aabb1, aabb2; Shape.ComputeAabb(out aabb1, transform1); Shape.ComputeAabb(out aabb2, transform2); Aabb aabb = new Aabb(); aabb.Combine(aabb1, aabb2); if (broadPhase.InRange(aabb)) { broadPhase.MoveProxy(ProxyId, aabb); return(true); } return(false); }
internal void RefilterProxy(BroadPhase broadPhase, XForm transform) { if (_proxyId == PairManager.NullProxy) { return; } broadPhase.DestroyProxy(_proxyId); AABB aabb; _shape.ComputeAABB(out aabb, transform); bool inRange = broadPhase.InRange(aabb); _proxyId = inRange ? broadPhase.CreateProxy(aabb, this) : PairManager.NullProxy; }
internal void RefilterProxy(BroadPhase broadPhase, Transform Transform) { if (_proxyId == PairManager.NullProxy) { return; } broadPhase.DestroyProxy(_proxyId); AABB aabb; _shape.ComputeAABB(out aabb, Transform); bool inRange = broadPhase.InRange(aabb); if (inRange) { _proxyId = broadPhase.CreateProxy(aabb, this); } else { _proxyId = PairManager.NullProxy; } }
/// <summary> /// Refilters the proxy using the specified broad phase /// </summary> /// <param name="broadPhase">The broad phase</param> /// <param name="transform">The transform</param> internal void RefilterProxy(BroadPhase broadPhase, XForm transform) { if (ProxyId == PairManager.NullProxy) { return; } broadPhase.DestroyProxy(ProxyId); Aabb aabb; Shape.ComputeAabb(out aabb, transform); bool inRange = broadPhase.InRange(aabb); if (inRange) { ProxyId = broadPhase.CreateProxy(aabb, this); } else { ProxyId = PairManager.NullProxy; } }
public void Create(BroadPhase broadPhase, Body body, Transform xf, FixtureDef def) { UserData = def.UserData; Friction = def.Friction; Restitution = def.Restitution; Density = def.Density; _body = body; _next = null; Filter = def.Filter; _isSensor = def.IsSensor; _type = def.Type; // Allocate and initialize the child shape. switch (_type) { case ShapeType.CircleShape: { CircleShape circle = new CircleShape(); CircleDef circleDef = (CircleDef)def; circle._position = circleDef.LocalPosition; circle._radius = circleDef.Radius; _shape = circle; } break; case ShapeType.PolygonShape: { PolygonShape polygon = new PolygonShape(); PolygonDef polygonDef = (PolygonDef)def; polygon.Set(polygonDef.Vertices, polygonDef.VertexCount); _shape = polygon; } break; case ShapeType.EdgeShape: { EdgeShape edge = new EdgeShape(); EdgeDef edgeDef = (EdgeDef)def; edge.Set(edgeDef.Vertex1, edgeDef.Vertex2); _shape = edge; } break; default: Box2DNetDebug.Assert(false); break; } // Create proxy in the broad-phase. AABB aabb; _shape.ComputeAABB(out aabb, xf); bool inRange = broadPhase.InRange(aabb); // You are creating a shape outside the world box. Box2DNetDebug.Assert(inRange); if (inRange) { _proxyId = broadPhase.CreateProxy(aabb, this); } else { _proxyId = PairManager.NullProxy; } }