public PhysxBoxCharacterObject(BoxControllerDescription BoxControllerDescription, Vector3 position, Matrix rotation, Vector3 scale) { this.scale = scale; this.BoxControllerDescription = BoxControllerDescription; this.BoxControllerDescription.Position = position.AsPhysX(); StillDesign.PhysX.MathPrimitives.Vector3 vec = BoxControllerDescription.Size; vec.X *= scale.X; vec.Y *= scale.Y; vec.Z *= scale.Z; BoxControllerDescription.Size = vec; this.rotation = rotation; }
public void CreateMultipleControllers() { using( CreateCoreAndScene() ) { ControllerManager manager = this.Scene.CreateControllerManager(); BoxControllerDescription descA = new BoxControllerDescription( new Vector3( 1.0f, 1.0f, 1.0f ), Vector3.Zero ); BoxController boxControllerA = manager.CreateController( descA ) as BoxController; boxControllerA.Dispose(); BoxControllerDescription descB = new BoxControllerDescription( new Vector3( 1.0f, 1.0f, 1.0f ), Vector3.Zero ); BoxController boxControllerB = manager.CreateController( descB ) as BoxController; } }
public void CreateMultipleControllers() { using (CreateCoreAndScene()) { ControllerManager manager = this.Scene.CreateControllerManager(); BoxControllerDescription descA = new BoxControllerDescription(new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero); BoxController boxControllerA = manager.CreateController(descA) as BoxController; boxControllerA.Dispose(); BoxControllerDescription descB = new BoxControllerDescription(new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero); BoxController boxControllerB = manager.CreateController(descB) as BoxController; } }
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager) { PhysxPhysicWorld PhysxPhysicWorld = World.PhysicWorld as PhysxPhysicWorld; base.LoadContent(GraphicInfo, factory, contentManager); { SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario"); PhysxTriangleMesh tmesh = new PhysxTriangleMesh(PhysxPhysicWorld, simpleModel, Matrix.Identity, Vector3.One); ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial fmaterial = new ForwardMaterial(shader); IObject obj = new IObject(fmaterial, simpleModel, tmesh); this.World.AddObject(obj); } { ///Controller description ///YOu have BoxControllerDescription and SphereControllerDescription BoxControllerDescription desc = new BoxControllerDescription(1, 1, 1); desc.UpDirection = Axis.Y; desc.SlopeLimit = 0; desc.SkinWidth = 0.2f; desc.StepOffset = 0.5f; desc.InteractionFlag = CCTInteractionFlag.Include | CCTInteractionFlag.UseFilter; SimpleModel sm = new SimpleModel(factory, "..\\Content\\Model\\block"); sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Blue), TextureType.DIFFUSE); ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial mat = new ForwardMaterial(shader); ///Character Object PhysxBoxCharacterObject PhysxCapsuleCharacterObject = new PhysxBoxCharacterObject(desc, new Vector3(50), Matrix.Identity, Vector3.One * 5); IObject marine = new IObject(mat, sm, PhysxCapsuleCharacterObject); this.World.AddObject(marine); marine.OnUpdate += new OnUpdate(marine_OnUpdate); } BallThrowPhysx28 BallThrowBullet = new BallThrowPhysx28(this.World, GraphicFactory); this.AttachCleanUpAble(BallThrowBullet); this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo)); }
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager) { PhysxPhysicWorld PhysxPhysicWorld = World.PhysicWorld as PhysxPhysicWorld; base.LoadContent(GraphicInfo, factory, contentManager); { SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario"); PhysxTriangleMesh tmesh = new PhysxTriangleMesh(PhysxPhysicWorld, simpleModel, Matrix.Identity, Vector3.One); ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial fmaterial = new ForwardMaterial(shader); IObject obj = new IObject(fmaterial, simpleModel, tmesh); this.World.AddObject(obj); } { ///Controller description ///YOu have BoxControllerDescription and SphereControllerDescription BoxControllerDescription desc = new BoxControllerDescription(1, 1, 1); desc.UpDirection = Axis.Y; desc.SlopeLimit = 0; desc.SkinWidth = 0.2f; desc.StepOffset = 0.5f; desc.InteractionFlag = CCTInteractionFlag.Include | CCTInteractionFlag.UseFilter; SimpleModel sm = new SimpleModel(factory, "..\\Content\\Model\\block"); sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Blue), TextureType.DIFFUSE); ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial mat = new ForwardMaterial(shader); ///Character Object PhysxBoxCharacterObject PhysxCapsuleCharacterObject = new PhysxBoxCharacterObject(desc, new Vector3(50) ,Matrix.Identity, Vector3.One * 5); IObject marine = new IObject(mat, sm, PhysxCapsuleCharacterObject); this.World.AddObject(marine); marine.OnUpdate += new OnUpdate(marine_OnUpdate); } BallThrowPhysx28 BallThrowBullet = new BallThrowPhysx28(this.World, GraphicFactory); this.AttachCleanUpAble(BallThrowBullet); this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo)); }
public void DisposeOfBoxController() { using (CreateCoreAndScene()) { var manager = this.Scene.CreateControllerManager(); var boxControllerDesc = new BoxControllerDescription(2, 5, 2) { }; var boxController = manager.CreateController(boxControllerDesc) as BoxController; boxController.Dispose(); GC.Collect(); Assert.IsTrue(boxController.IsDisposed); Assert.IsTrue(manager.Controllers.Count == 0); } }
public void DisposeOfBoxController() { using( CreateCoreAndScene() ) { var manager = this.Scene.CreateControllerManager(); var boxControllerDesc = new BoxControllerDescription( 2, 5, 2 ) { }; var boxController = manager.CreateController( boxControllerDesc ) as BoxController; boxController.Dispose(); GC.Collect(); Assert.IsTrue( boxController.IsDisposed ); Assert.IsTrue( manager.Controllers.Count == 0 ); } }