public override void GetPhysicsObjectsInRange(Vector3 position, float distance, CullerConditionAvaliator <IPhysicObject, SceneControl.IObject> CullerAvaliator, List <IPhysicObject> resp) { SphereGeometry SphereGeometry = new PhysX.SphereGeometry(distance); foreach (var item in scene.OverlapMultiple(SphereGeometry, PhysX.Math.Matrix.Translation(position.AsPhysX()))) { if (item.UserData is IPhysicObject) { IPhysicObject IPhysicObject = item.UserData as IPhysicObject; if (CullerAvaliator(IPhysicObject, IPhysicObject.ObjectOwner)) { resp.Add(IPhysicObject); } } } }
/// <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 GetPhysicsObjectsInRange(Vector3 position, float distance, CullerConditionAvaliator<IPhysicObject, SceneControl.IObject> CullerAvaliator, List<IPhysicObject> resp) { SphereGeometry SphereGeometry = new PhysX.SphereGeometry(distance); foreach (var item in scene.OverlapMultiple(SphereGeometry, PhysX.Math.Matrix.Translation(position.AsPhysX()))) { if (item.UserData is IPhysicObject) { IPhysicObject IPhysicObject = item.UserData as IPhysicObject; if (CullerAvaliator(IPhysicObject, IPhysicObject.ObjectOwner)) { resp.Add(IPhysicObject); } } } }