private void AddPendingProxies()
 {
     for (int index = 0; index < pendingProxies.Count; ++index)
     {
         BodyProxy proxy = pendingProxies[index];
         Body.CreateProxy(proxy.Body1, proxy.Body2, proxy.transformation);
     }
     pendingProxies.Clear();
 }
示例#2
0
文件: Body.cs 项目: Anttifer/Jypeli
        private static void AddProxySingle(Body body1, Body body2, Matrix2x2 transformation)
        {
            BodyProxy proxy1 = new BodyProxy(body2, body1, transformation.Inverted);
            BodyProxy proxy2 = new BodyProxy(body1, body2, transformation);

            proxy1.invertedTwin = proxy2;
            proxy2.invertedTwin = proxy1;
            body1.proxies.AddLast(proxy2.node);
            body2.proxies.AddLast(proxy1.node);
        }
示例#3
0
文件: Body.cs 项目: Anttifer/Jypeli
 private static void AddProxyList(Body body1, Body body2, Matrix2x2 transformation)
 {
     for (LinkedListNode <BodyProxy> node = body2.proxies.First;
          node != null;
          node = node.Next)
     {
         BodyProxy proxyT = node.Value;
         AddProxySingle(body1, proxyT.Body2,
                        transformation * proxyT.transformation);
     }
 }
示例#4
0
文件: Body.cs 项目: Anttifer/Jypeli
 /// <summary>
 /// This will remove this body from any proxy list it is a part of.
 /// </summary>
 private void RemoveFromProxy()
 {
     if (proxies.Count == 0)
     {
         return;
     }
     for (LinkedListNode <BodyProxy> node = proxies.First;
          node != null;
          node = node.Next)
     {
         BodyProxy proxy = node.Value.invertedTwin;
         proxy.node.List.Remove(proxy.node);
     }
     proxies.Clear();
 }
示例#5
0
文件: Body.cs 项目: Anttifer/Jypeli
 /// <summary>
 /// This applys the proxy.
 /// This will cause all other bodies in the proxy list to have their velocity set
 /// to this body’s.
 /// With the appropriate transformations applied.
 /// </summary>
 public void ApplyProxy()
 {
     if (proxies.Count == 0)
     {
         return;
     }
     for (LinkedListNode <BodyProxy> node = proxies.First;
          node != null;
          node = node.Next)
     {
         BodyProxy    proxy = node.Value;
         PhysicsState state = proxy.Body2.state;
         state.Velocity.Angular = this.state.Velocity.Angular;
         Vector2D.Transform(
             ref proxy.transformation,
             ref this.state.Velocity.Linear,
             out state.Velocity.Linear);
     }
 }