Ejemplo n.º 1
0
        public override void AddConstraint(IPhysicConstraint ctn)
        {
            if (ctn is PhysxCylindricalJoint)
            {
                PhysxCylindricalJoint PhysxCylindricalJoint = ctn as PhysxCylindricalJoint;
                PhysxCylindricalJoint.CylindricalJoint = Scene.CreateJoint <CylindricalJoint>(PhysxCylindricalJoint.CylindricalJointDescription);
            }
            else if (ctn is PhysxD6Joint)
            {
                PhysxD6Joint PhysxCylindricalJoint = ctn as PhysxD6Joint;
                PhysxCylindricalJoint.D6Joint = Scene.CreateJoint <D6Joint>(PhysxCylindricalJoint.D6JointDescription);
            }
            else if (ctn is PhysxDistanceJoint)
            {
                PhysxDistanceJoint PhysxCylindricalJoint = ctn as PhysxDistanceJoint;
                PhysxCylindricalJoint.DistanceJoint = Scene.CreateJoint <DistanceJoint>(PhysxCylindricalJoint.DistanceJointDescription);
            }
            else if (ctn is PhysxFixedJoint)
            {
                PhysxFixedJoint PhysxCylindricalJoint = ctn as PhysxFixedJoint;
                PhysxCylindricalJoint.FixedJoint = Scene.CreateJoint <FixedJoint>(PhysxCylindricalJoint.FixedJointDescription);
            }

            else if (ctn is PhysxPointOnLineJoint)
            {
                PhysxPointOnLineJoint PhysxCylindricalJoint = ctn as PhysxPointOnLineJoint;
                PhysxCylindricalJoint.PointOnLineJoint = Scene.CreateJoint <PointOnLineJoint>(PhysxCylindricalJoint.PointOnLineJointDescription);
            }

            else if (ctn is PhysxPrismaticJoint)
            {
                PhysxPrismaticJoint PhysxCylindricalJoint = ctn as PhysxPrismaticJoint;
                PhysxCylindricalJoint.PrismaticJoint = Scene.CreateJoint <PrismaticJoint>(PhysxCylindricalJoint.PrismaticJointDescription);
            }

            else if (ctn is PhysxPulleyJoint)
            {
                PhysxPulleyJoint PhysxCylindricalJoint = ctn as PhysxPulleyJoint;
                PhysxCylindricalJoint.PulleyJoint = Scene.CreateJoint <PulleyJoint>(PhysxCylindricalJoint.PulleyJointDescription);
            }

            else if (ctn is PhysxRevoluteJoint)
            {
                PhysxRevoluteJoint PhysxCylindricalJoint = ctn as PhysxRevoluteJoint;
                PhysxCylindricalJoint.RevoluteJoint = Scene.CreateJoint <RevoluteJoint>(PhysxCylindricalJoint.RevoluteJointDescription);
            }

            else if (ctn is PhysxSphericalJoint)
            {
                PhysxSphericalJoint PhysxCylindricalJoint = ctn as PhysxSphericalJoint;
                PhysxCylindricalJoint.SphericalJoint = Scene.CreateJoint <SphericalJoint>(PhysxCylindricalJoint.SphericalJointDescription);
            }

            ctns.Add(ctn);
        }
Ejemplo n.º 2
0
        public override void RemoveConstraint(IPhysicConstraint ctn)
        {
            if (ctn is PhysxCylindricalJoint)
            {
                PhysxCylindricalJoint PhysxCylindricalJoint = ctn as PhysxCylindricalJoint;
                PhysxCylindricalJoint.CylindricalJoint.Dispose();
            }
            else if (ctn is PhysxD6Joint)
            {
                PhysxD6Joint PhysxCylindricalJoint = ctn as PhysxD6Joint;
                PhysxCylindricalJoint.D6Joint.Dispose();
            }
            else if (ctn is PhysxDistanceJoint)
            {
                PhysxDistanceJoint PhysxCylindricalJoint = ctn as PhysxDistanceJoint;
                PhysxCylindricalJoint.DistanceJoint.Dispose();
            }
            else if (ctn is PhysxFixedJoint)
            {
                PhysxFixedJoint PhysxCylindricalJoint = ctn as PhysxFixedJoint;
                PhysxCylindricalJoint.FixedJoint.Dispose();
            }

            else if (ctn is PhysxPointOnLineJoint)
            {
                PhysxPointOnLineJoint PhysxCylindricalJoint = ctn as PhysxPointOnLineJoint;
                PhysxCylindricalJoint.PointOnLineJoint.Dispose();
            }

            else if (ctn is PhysxPrismaticJoint)
            {
                PhysxPrismaticJoint PhysxCylindricalJoint = ctn as PhysxPrismaticJoint;
                PhysxCylindricalJoint.PrismaticJoint.Dispose();
            }

            else if (ctn is PhysxPulleyJoint)
            {
                PhysxPulleyJoint PhysxCylindricalJoint = ctn as PhysxPulleyJoint;
                PhysxCylindricalJoint.PulleyJoint.Dispose();
            }

            else if (ctn is PhysxRevoluteJoint)
            {
                PhysxRevoluteJoint PhysxCylindricalJoint = ctn as PhysxRevoluteJoint;
                PhysxCylindricalJoint.RevoluteJoint.Dispose();
            }

            else if (ctn is PhysxSphericalJoint)
            {
                PhysxSphericalJoint PhysxCylindricalJoint = ctn as PhysxSphericalJoint;
                PhysxCylindricalJoint.SphericalJoint.Dispose();
            }
            ctns.Remove(ctn);
        }