示例#1
0
        private void Draw(cpDampedSpring constraint)
        {
            var a = constraint.a.LocalToWorld(constraint.GetAnchorA());
            var b = constraint.b.LocalToWorld(constraint.GetAnchorB());

            DrawSpring(a, b, CONSTRAINT_COLOR);
        }
示例#2
0
		private void Draw(cpDampedSpring constraint)
		{

			var a = constraint.a.LocalToWorld(constraint.GetAnchorA());
			var b = constraint.b.LocalToWorld(constraint.GetAnchorB());

			DrawSpring(a, b, CONSTRAINT_COLOR);

		}
示例#3
0
		protected bool Init(CCPhysicsBody a, CCPhysicsBody b, CCPoint anchr1, CCPoint anchr2, float stiffness, float damping)
		{
			if (!base.Init(a, b))
				return false;

            var anch1 = PhysicsHelper.CCPointToCpVect(anchr1);
            var anch2 = PhysicsHelper.CCPointToCpVect(anchr2);
			cpConstraint joint = new cpDampedSpring(GetBodyInfo(a).Body,
													GetBodyInfo(b).Body,
                anch1,
                anch2,
													cpVect.cpvdist(
                    _bodyB.Local2World(anch1), _bodyA.Local2World(anch2)),
													stiffness,
													damping);

			if (joint == null)
				return false;

			_info.Add(joint);

			return true;

		}
示例#4
0
 public float defaultSpringForce(cpDampedSpring spring, float dist)
 {
     return (spring.restLength - dist) * spring.stiffness;
 }
示例#5
0
 public float defaultSpringForce(cpDampedSpring spring, float dist)
 {
     return((spring.restLength - dist) * spring.stiffness);
 }