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); }
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); }
/// <summary> /// Removes the constraint. /// </summary> /// <param name="ctn">The CTN.</param> public override void RemoveConstraint(IPhysicConstraint ctn) { if (ctn.PhysicConstraintType == PhysicConstraintType.JOINT) { JointConstraint bctn = ctn as JointConstraint; space.Remove(bctn.Joint); ctns.Remove(bctn); } else if (ctn.PhysicConstraintType == PhysicConstraintType.SOLVER) { MultipleSubConstraints co = ctn as MultipleSubConstraints; { space.Remove(co.Constraint); ctns.Remove(co);; } } }
public override void AddConstraint(IPhysicConstraint ctn) { if (ctn.PhysicConstraintType == PhysicConstraintType.JOINT) { JointConstraint co = (JointConstraint)ctn; if (co != null) { space.Add(co.Joint); ctns.Add(co); } } else if (ctn.PhysicConstraintType == PhysicConstraintType.SOLVER) { MultipleSubConstraints co = (MultipleSubConstraints)ctn; if (co != null) { space.Add(co.Constraint); ctns.Add(co); } } }
/// <summary> /// Removes the constraint. /// </summary> /// <param name="ctn">The CTN.</param> public override void RemoveConstraint(IPhysicConstraint ctn) { if (ctn.PhysicConstraintType == PhysicConstraintType.JOINT) { JointConstraint bctn = ctn as JointConstraint; space.Remove(bctn.Joint); ctns.Remove(bctn); } else if (ctn.PhysicConstraintType == PhysicConstraintType.SOLVER) { MultipleSubConstraints co = ctn as MultipleSubConstraints; { space.Remove(co.Constraint); ctns.Remove(co); ; } } }
public override void AddConstraint(IPhysicConstraint ctn) { if (ctn.PhysicConstraintType == PhysicConstraintType.JOINT) { JointConstraint co = (JointConstraint)ctn; if (co != null) { space.Add(co.Joint); ctns.Add(co); } } else if (ctn.PhysicConstraintType == PhysicConstraintType.SOLVER) { MultipleSubConstraints co = (MultipleSubConstraints)ctn; if (co != null) { space.Add(co.Constraint); ctns.Add(co); } } }
public override void RemoveConstraint(IPhysicConstraint ctn) { throw new System.NotImplementedException(); }
/// <summary> /// Removes the constraints /// </summary> /// <param name="ctn"></param> public abstract void RemoveConstraint(IPhysicConstraint ctn);
/// <summary> /// Adds the constraint /// </summary> /// <param name="ctn"></param> public abstract void AddConstraint(IPhysicConstraint ctn);
/// <summary> /// Removes the constraints /// </summary> /// <param name="ctn"></param> public abstract void RemoveConstraint(IPhysicConstraint ctn);
/// <summary> /// Adds the constraint /// </summary> /// <param name="ctn"></param> public abstract void AddConstraint(IPhysicConstraint ctn);
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); }
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); }
public override void RemoveConstraint(IPhysicConstraint ctn) { throw new System.NotImplementedException(); }
public void LoadWorld(GraphicFactory factory, GraphicInfo ginfo, IWorld world, ModelLoaderData worldData) { objinfos.Clear(); foreach (var item in worldData.ModelMeshesInfo) { if (objinfos.ContainsKey(item.modelName + item.meshIndex)) { objinfos[item.modelName + item.meshIndex].Add(item); } else { objinfos[item.modelName + item.meshIndex] = new List <ObjectInformation>(); objinfos[item.modelName + item.meshIndex].Add(item); } } foreach (var item in objinfos.Keys) { if (OnCreateIObject != null) { IObject[] obj = OnCreateIObject(world, factory, ginfo, objinfos[item].ToArray()); if (obj != null) { foreach (var ob in obj) { world.AddObject(ob); } } } else { foreach (var obj in WorldLoader.CreateOBJ(world, factory, ginfo, objinfos[item].ToArray())) { world.AddObject(obj); } } } foreach (var item in worldData.ConstraintInfo) { List <IObject> obb = world.Objects.ToList(); IObject o1 = obb.First(delegate(IObject o) { return(o.Name == item.bodyA); }); IObject o2 = obb.First(delegate(IObject o) { return(o.Name == item.bodyB); }); if (o1.PhysicObject.PhysicObjectTypes != PhysicObjectTypes.TRIANGLEMESHOBJECT && o2.PhysicObject.PhysicObjectTypes != PhysicObjectTypes.TRIANGLEMESHOBJECT) { if (OnCreateIConstraint != null) { IPhysicConstraint constr = OnCreateIConstraint(world, factory, ginfo, item, o1, o2); if (constr != null) { world.PhysicWorld.AddConstraint(constr); } } else { IPhysicConstraint constr = WorldLoader.CreateConstraint(world, factory, ginfo, item, o1, o2); world.PhysicWorld.AddConstraint(constr); } } } foreach (var item in worldData.LightsInfo) { if (OnCreateILight != null) { ILight l = OnCreateILight(world, factory, ginfo, item); if (l != null) { world.AddLight(l); } } else { world.AddLight(item); } } foreach (var item in worldData.CameraInfo) { if (OnCreateICamera != null) { ICamera cam = OnCreateICamera(world, factory, ginfo, item); if (cam != null) { world.CameraManager.AddCamera(cam); } } else { world.CameraManager.AddCamera(WorldLoader.CreateCamera(world, factory, ginfo, item)); } } foreach (var item in worldData.DummyInfo) { if (OnProcessDummies != null) { OnProcessDummies(world, item); } } foreach (var item in worldData.ParticleInfo) { if (OnCreateIParticle != null) { IParticleSystem part = OnCreateIParticle(world, item); if (part != null) { world.ParticleManager.AddAndInitializeParticleSystem(part); (part as DPFSParticleSystem).IDPSFParticleSystem.Emitter.PositionData.Position = item.Position; (part as DPFSParticleSystem).IDPSFParticleSystem.Emitter.OrientationData.Orientation = item.Orientation; } } } }