示例#1
0
        public void addElement(String name, Wheel Element)
        {
            D6JointDescription jointDesc = null;

            if (name == "Cylindrical")
            {
                jointDesc        = new D6JointDescription();
                jointDesc.Actor1 = this.actor;
                jointDesc.Actor2 = Element.actor;
                jointDesc.SetGlobalAnchor(new StillDesign.PhysX.MathPrimitives.Vector3(0, 0, 0));
                //jointDesc.SetGlobalAxis(new StillDesign.PhysX.MathPrimitives.Vector3(1, 0, 0));
                jointDesc.TwistMotion    = D6JointMotion.Locked;
                jointDesc.Swing1Motion   = D6JointMotion.Locked;
                jointDesc.Swing2Motion   = D6JointMotion.Locked;
                jointDesc.XMotion        = D6JointMotion.Free;
                jointDesc.YMotion        = D6JointMotion.Free;
                jointDesc.ZMotion        = D6JointMotion.Free;
                jointDesc.ProjectionMode = JointProjectionMode.None;
            }

            //D6Joint joint = game.scene.CreateJoint(jointDesc) as D6Joint;
            //joint.SetDriveAngularVelocity(new StillDesign.PhysX.MathPrimitives.Vector3(0,0,0));
            MotorDescription motorDesc = new MotorDescription();

            motorDesc.MaximumForce    = 200;
            motorDesc.VelocityTarget  = 0;
            motorDesc.FreeSpinEnabled = false;

            //joint.Motor = motorDesc;
            //joint.BreakableMaxTorque = 100;


            //Element.shape = this.actor.CreateShape(Element.shapeDesc) as WheelShape;
            //elements.Add(Element);
        }
示例#2
0
		public void ReleaseJoint()
		{
			using( CreateCoreAndScene() )
			{
				Actor actorA, actorB;
				{
					ActorDescription actorDesc = new ActorDescription()
					{
						BodyDescription = new BodyDescription( 20 ),
						Shapes = { new BoxShapeDescription( 5, 6, 7 ) }
					};

					actorA = this.Scene.CreateActor( actorDesc );
				}
				{
					ActorDescription actorDesc = new ActorDescription()
					{
						BodyDescription = new BodyDescription( 20 ),
						Shapes = { new BoxShapeDescription( 2, 5, 7 ) }
					};

					actorB = this.Scene.CreateActor( actorDesc );
				}

				D6JointDescription d6JointDesc = new D6JointDescription()
				{
					Actor1 = actorA,
					Actor2 = actorB
				};

				d6JointDesc.SetGlobalAnchor( new Vector3( 5, 6, 7 ) );
				d6JointDesc.SetGlobalAxis( new Vector3( 0, 0, 1 ) );

				D6Joint d6 = this.Scene.CreateJoint( d6JointDesc ) as D6Joint;

				d6.Dispose();
			}
		}
示例#3
0
        public void ReleaseJoint()
        {
            using (CreateCoreAndScene())
            {
                Actor actorA, actorB;
                {
                    ActorDescription actorDesc = new ActorDescription()
                    {
                        BodyDescription = new BodyDescription(20),
                        Shapes          = { new BoxShapeDescription(5, 6, 7) }
                    };

                    actorA = this.Scene.CreateActor(actorDesc);
                }
                {
                    ActorDescription actorDesc = new ActorDescription()
                    {
                        BodyDescription = new BodyDescription(20),
                        Shapes          = { new BoxShapeDescription(2, 5, 7) }
                    };

                    actorB = this.Scene.CreateActor(actorDesc);
                }

                D6JointDescription d6JointDesc = new D6JointDescription()
                {
                    Actor1 = actorA,
                    Actor2 = actorB
                };

                d6JointDesc.SetGlobalAnchor(new Vector3(5, 6, 7));
                d6JointDesc.SetGlobalAxis(new Vector3(0, 0, 1));

                D6Joint d6 = this.Scene.CreateJoint(d6JointDesc) as D6Joint;

                d6.Dispose();
            }
        }
示例#4
0
文件: SLPJoint.cs 项目: yhirano-/STFW
        public SLJoint(
            SLAct actorA, SLAct actorB, float anchor_x, float anchor_y, float anchor_z, float axis_x, float axis_y, float axis_z)
        {
            Vector3 anchor = new Vector3(anchor_x, anchor_y, anchor_z);
            Vector3 axis   = new Vector3(axis_x, axis_y, axis_z);

            act_anc     = anchor;
            d6JointDesc = new StillDesign.PhysX.D6JointDescription();
            d6JointDesc.SetToDefault();

            d6JointDesc.Actor1 = actorA != null ? actorA.actor : null;
            d6JointDesc.Actor2 = actorB != null ? actorB.actor : null;

            d6JointDesc.DriveLinearVelocity = new Vector3(0, 0, 0);

            // グローバル座標でのアンカーの場所
            d6JointDesc.SetGlobalAnchor(anchor);

            // グローバル座標での回転軸
            d6JointDesc.SetGlobalAxis(axis);

            // 回転方向の制約
            d6JointDesc.TwistMotion  = StillDesign.PhysX.D6JointMotion.Locked;
            d6JointDesc.Swing1Motion = StillDesign.PhysX.D6JointMotion.Locked;
            d6JointDesc.Swing2Motion = StillDesign.PhysX.D6JointMotion.Locked;

            // 移動方向の制約
            d6JointDesc.XMotion = StillDesign.PhysX.D6JointMotion.Locked;
            d6JointDesc.YMotion = StillDesign.PhysX.D6JointMotion.Locked;
            d6JointDesc.ZMotion = StillDesign.PhysX.D6JointMotion.Locked;

            d6JointDesc.ProjectionMode = StillDesign.PhysX.JointProjectionMode.None;

            act1 = actorA;
            act2 = actorB;
        }