/// <summary> /// Create a simple Sphere object /// </summary> /// <param name="pos"></param> /// <param name="ori"></param> /// <returns></returns> private IObject SpawnPrimitive(Vector3 pos, Matrix ori) { ///Load a Model with a custom texture SimpleModel sm2 = new SimpleModel(factory, "Model\\ball"); sm2.SetTexture(factory.CreateTexture2DColor(1, 1, Color.White, false), TextureType.DIFFUSE); ForwardXNABasicShader nd = new ForwardXNABasicShader(); IMaterial m = new ForwardMaterial(nd); PhysxPhysicWorld PhysxPhysicWorld = _mundo.PhysicWorld as PhysxPhysicWorld; SphereGeometry SphereGeometry = new PhysX.SphereGeometry(1); PhysxPhysicObject PhysxPhysicObject = new PloobsEngine.Physics3x.PhysxPhysicObject(PhysxPhysicWorld.Scene, SphereGeometry, 10, Matrix.Identity, Matrix.CreateTranslation(pos), Vector3.One, PloobsEngine.Physics.MaterialDescription.DefaultPhysxMaterial()); IObject o = new IObject(m, sm2, PhysxPhysicObject); return o; }
/// <summary> /// Create a simple Sphere object /// </summary> /// <param name="pos"></param> /// <param name="ori"></param> /// <returns></returns> private IObject SpawnPrimitive(Vector3 pos, Matrix ori) { ///Load a Model with a custom texture SimpleModel sm2 = new SimpleModel(factory, "Model\\ball"); sm2.SetTexture(factory.CreateTexture2DColor(1, 1, Color.White, false), TextureType.DIFFUSE); ForwardXNABasicShader nd = new ForwardXNABasicShader(); IMaterial m = new ForwardMaterial(nd); PhysxPhysicWorld PhysxPhysicWorld = _mundo.PhysicWorld as PhysxPhysicWorld; SphereGeometry SphereGeometry = new PhysX.SphereGeometry(1); PhysxPhysicObject PhysxPhysicObject = new PloobsEngine.Physics3x.PhysxPhysicObject(PhysxPhysicWorld.Scene, SphereGeometry, 10, Matrix.Identity, Matrix.CreateTranslation(pos), Vector3.One, PloobsEngine.Physics.MaterialDescription.DefaultPhysxMaterial()); IObject o = new IObject(m, sm2, PhysxPhysicObject); return(o); }
public override void AddObject(IPhysicObject obj) { if (obj is PhysxPhysicObject) { PhysxPhysicObject PhysxPhysicObject = obj as PhysxPhysicObject; PhysxPhysicObject.RigidActor.UserData = obj; scene.AddActor(PhysxPhysicObject.RigidActor); } else if (obj is PhysxTriangleMesh) { PhysxTriangleMesh PhysxTriangleMesh = obj as PhysxTriangleMesh; PhysxTriangleMesh.StaticActor.UserData = obj; scene.AddActor(PhysxTriangleMesh.StaticActor); } else if (obj is PhysxStaticActor) { PhysxStaticActor PhysxTriangleMesh = obj as PhysxStaticActor; PhysxTriangleMesh.StaticActor.UserData = obj; scene.AddActor(PhysxTriangleMesh.StaticActor); } objs.Add(obj); }
public override void DetectCollisions(IPhysicObject po, List <IPhysicObject> resp) { PhysxPhysicObject PhysxPhysicObject = po as PhysxPhysicObject; }