Beispiel #1
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();
			}
		}
Beispiel #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();
            }
        }
Beispiel #3
0
        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;
        }