コード例 #1
0
 /// Apply an impulse at a point. This immediately modifies the velocity.
 /// It also modifies the angular velocity if the point of application
 /// is not at the center of mass.
 public void ApplyLinearImpluse(Fix64Vec2 impluse, Fix64Vec2 worldPoint)
 {
     Parallel2D.ApplyLinearImpulse(_body2D, worldPoint, impluse);
 }
コード例 #2
0
 //Apply a force at a world point
 public void ApplyForce(Fix64Vec2 force, Fix64Vec2 worldPoint)
 {
     Parallel2D.ApplyForce(_body2D, worldPoint, force);
 }
コード例 #3
0
 //Apply an impulse to the center of mass. This immediately modifies the velocity.
 public void ApplyLinearImpulse(Fix64Vec2 impluse)
 {
     Parallel2D.ApplyLinearImpulseToCenter(_body2D, impluse);
 }
コード例 #4
0
 public void UpdateShape(Fix64Vec2 size)
 {
     _size = size;
     UpdateShape(_root);
 }
コード例 #5
0
 //============================== Force and Torque ==============================
 //Apply a force to the center of mass
 public void ApplyForce(Fix64Vec2 force)
 {
     Parallel2D.ApplyForceToCenter(_body2D, force);
 }
コード例 #6
0
ファイル: Fix64Vec2.cs プロジェクト: waynesohot/upmtest
        public static Fix64Vec2 Intersection(Fix64Vec2 a1, Fix64Vec2 v, Fix64 range, Fix64Vec2 b1, Fix64Vec2 b2, out bool found)
        {
            Fix64Vec2 a2 = a1 + v.normalized * range;

            return(Intersection(a1, a2, b1, b2, out found));
        }
コード例 #7
0
ファイル: Fix64Vec2.cs プロジェクト: waynesohot/upmtest
        public static Fix64Vec2 Intersection(Fix64Vec2 a1, Fix64Vec2 a2, Fix64Vec2 b1, Fix64Vec2 b2, out bool found)
        {
            Fix64 tmp = (b2.x - b1.x) * (a2.y - a1.y) - (b2.y - b1.y) * (a2.x - a1.x);

            if (tmp == Fix64.zero)
            {
                // No solution!
                found = false;
                return(Fix64Vec2.zero);
            }

            Fix64 mu = ((a1.x - b1.x) * (a2.y - a1.y) - (a1.y - b1.y) * (a2.x - a1.x)) / tmp;

            found = true;

            return(new Fix64Vec2(
                       b1.x + (b2.x - b1.x) * mu,
                       b1.y + (b2.y - b1.y) * mu
                       ));
        }
コード例 #8
0
ファイル: Fix64Vec2.cs プロジェクト: waynesohot/upmtest
 //Cross product of two vectors
 public static Fix64 Cross(Fix64Vec2 a, Fix64Vec2 b)
 {
     return(a.x * b.y - a.y * b.x);
 }
コード例 #9
0
ファイル: Fix64Vec2.cs プロジェクト: waynesohot/upmtest
 //Dot product of two vectors
 public static Fix64 Dot(Fix64Vec2 a, Fix64Vec2 b)
 {
     return(a.x * b.x + a.y * b.y);
 }
コード例 #10
0
ファイル: Fix64Vec2.cs プロジェクト: waynesohot/upmtest
 //Distance between two points
 public static Fix64 Distance(Fix64Vec2 a, Fix64Vec2 b)
 {
     return((a - b).Length());
 }