private void CreateTower(Nx.Material material, NxVector3 descriptor, int xCount, int yCount, int zCount, float xSpace, float ySpace, float zSpace, float xOffset, float yOffset, float zOffset) { for (int x = 0; x < xCount; x++) for (int y = 0; y < yCount; y++) for (int z = 0; z < zCount; z++) { var rigidBodyDesc = new BodyDescription(); var boxDesc = new BoxShapeDescription { Material = material, Dimensions = new NxVector3(descriptor.X / 2, descriptor.Y / 2, descriptor.Z / 2) }; var actorDesc = new ActorDescription(boxDesc) { BodyDescription = rigidBodyDesc, Density = 10.0f, GlobalPose = NxMath.Matrix.Translation( xOffset + x * xSpace - ((xCount - 1) * xSpace / 2), yOffset + y * ySpace - ((yCount - 1) * ySpace / 2), zOffset + z * zSpace - ((zCount - 1) * zSpace / 2)), UserData = _boxModel }; if (!actorDesc.IsValid()) throw new Exception("ActorDesc invalid!"); var actor = _scene.CreateActor(actorDesc); if (actor == null) throw new Exception("Actor invalid!"); } }
private void CreateBoxes(Nx.Material material) { for (int x = 0; x < XCount; x++) for (int y = 0; y < YCount; y++) for (int z = 0; z < ZCount; z++) { var rigidBodyDesc = new BodyDescription(); var boxDesc = new BoxShapeDescription { Material = material, Dimensions = new NxVector3(WidthX / 2, WidthY / 2, WidthZ / 2) }; var actorDesc = new ActorDescription(boxDesc) { BodyDescription = rigidBodyDesc, Density = 10.0f, GlobalPose = NxMath.Matrix.Translation( XOffset + x * XSpace - ((XCount - 1) * XSpace / 2), YOffset + y * YSpace - ((YCount - 1) * YSpace / 2), ZOffset + z * ZSpace - ((ZCount - 1) * ZSpace / 2)), UserData = _boxModel }; if (!actorDesc.IsValid()) throw new Exception("ActorDesc invalid!"); var actor = _scene.CreateActor(actorDesc); if (actor == null) throw new Exception("Actor invalid!"); } }
public Material(RigidBody rigidBody, PX.Material wrappedMaterial, MaterialDescriptor descriptor) { wrappedMaterial.DynamicFriction = descriptor.Friction; wrappedMaterial.StaticFriction = descriptor.Friction; wrappedMaterial.Restitution = descriptor.Restitution; _wrappedMaterial = wrappedMaterial; Configurator = new BaseConfigurator<IMaterial>(); }
private void CreateGround(Nx.Material material) { var planeShapeDesc = new PlaneShapeDescription(0, 1, 0, 0) { Material = material, UserData = _planeModel }; var actorDesc = new ActorDescription(planeShapeDesc) { BodyDescription = null }; _scene.CreateActor(actorDesc); }