예제 #1
0
 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);
     }
 }