예제 #1
0
        private void Draw(cpPivotJoint constraint)
        {
            cpVect a = cpTransform.Point(constraint.a.transform, constraint.GetAnchorA());
            cpVect b = cpTransform.Point(constraint.b.transform, constraint.GetAnchorB());

            //DrawSegment(a, b, 1, cpColor.Grey);
            DrawDot(a, 3, CONSTRAINT_COLOR);
            DrawDot(b, 3, CONSTRAINT_COLOR);
        }
예제 #2
0
		private void Draw(cpPivotJoint constraint)
		{

			cpVect a = cpTransform.Point(constraint.a.transform, constraint.GetAnchorA());
			cpVect b = cpTransform.Point(constraint.b.transform, constraint.GetAnchorB());

			//DrawSegment(a, b, 1, cpColor.Grey);
			DrawDot(a, 3, CONSTRAINT_COLOR);
			DrawDot(b, 3, CONSTRAINT_COLOR);

		}
예제 #3
0
        protected bool Init(CCPhysicsBody a, CCPhysicsBody b, CCPoint anchr)
		{

			if (!base.Init(a, b))
				return false;

			GetBodyNode(a).Position = anchr;
			GetBodyNode(b).Position = anchr;

			// add a pivot joint to fixed two body together
			//cpConstraint joint = cpPivotJoint.cpPivotJointNew(getBodyInfo(a).getBody(),
			//                                       getBodyInfo(b).getBody(),
			//                                      anchr);

			cpConstraint joint = new cpPivotJoint(GetBodyInfo(a).Body, GetBodyInfo(b).Body, PhysicsHelper.CCPointToCpVect(anchr));

			if (joint == null)
				return false;

			_info.Add(joint);


			// add a gear joint to make two body have the same rotation.
			joint = new cpGearJoint(GetBodyInfo(a).Body, GetBodyInfo(b).Body, 0, 1);

			if (joint == null)
				return false;

			_info.Add(joint);

			SetCollisionEnable(false);

			return true;
		}
예제 #4
0
		//static PhysicsJointPin* ruct(PhysicsBody* a, PhysicsBody* b,  cpVect anchr);
		#region PROTECTED FUNC


        protected bool Init(CCPhysicsBody a, CCPhysicsBody b, CCPoint anchr)
		{
			if (!base.Init(a, b))
				return false;


			cpConstraint joint = new cpPivotJoint(GetBodyInfo(a).Body, GetBodyInfo(b).Body,
                PhysicsHelper.CCPointToCpVect(anchr));

			if (joint == null)
				return false;

			_info.Add(joint);

			return true;
		}
예제 #5
0
		//static PhysicsJointPin* ruct(PhysicsBody* a, PhysicsBody* b,  cpVect anchr);
		#region PROTECTED FUNC


		protected bool Init(CCPhysicsBody a, CCPhysicsBody b, cpVect anchr)
		{
			if (!base.Init(a, b))
				return false;


			cpConstraint joint = new cpPivotJoint(GetBodyInfo(a).GetBody(), GetBodyInfo(b).GetBody(),
										   anchr);

			if (joint == null)
				return false;

			_info.Add(joint);

			return true;
		}