public HoldOffsetComponent(Entity parent, BepuPhysicsComponent otherPhysicsComponent) : base(parent, "HoldOffsetComponent") { this.otherPhysicsComponent = otherPhysicsComponent; this.thisPhysicsComponent = (BepuPhysicsComponent)Parent.GetComponent("BepuPhysicsComponent"); this.offset = thisPhysicsComponent.Box.Position - otherPhysicsComponent.Box.Position; }
public BepuPhysicsBox(Box b, Model m) { // Create the physics Component. bepuPhysicsComponent = new BepuPhysicsComponent(this, b); // Create the rendering component. Since the cube model is 1x1x1, // it needs to be scaled to match the size of each individual box. Matrix scaling = Matrix.CreateScale(b.Width, b.Height, b.Length); BasicModelComponent drawComponent = new CubeRenderComponent(this, scaling); this.AttachComponent(bepuPhysicsComponent); this.AttachComponent(drawComponent); }
public Platform(Vector3 position, float width, float height, float length) { this.width = width; this.height = height; this.length = length; // Create the physics Component. this.bepuPhysicsComponent = new BepuPhysicsComponent(this, new Box(position, width, height, length)); // Create the rendering component. Since the cube model is 1x1x1, // it needs to be scaled to match the size of each individual box. Matrix scaling = Matrix.CreateScale(width, height, length); BasicModelComponent drawComponent = new CubeRenderComponent(this, scaling); this.AttachComponent(bepuPhysicsComponent); this.AttachComponent(drawComponent); }
public Character(string id, int lives, Box box, PlayerIndex controllingPlayer, int team, Environment environment, Color color) { // Create the vitality component to track the character's health. vitalityComponent = new VitalityComponent(this, lives); this.AttachComponent(vitalityComponent); // Create the info component to track the character information. characterInformationComponent = new CharacterInformationComponent(this, controllingPlayer, team, color); this.AttachComponent(characterInformationComponent); // Create the physics Component. // This will actually probably just translate into one box for jumps/gravity/trajectories // and collision between characters. bepuPhysicsComponent = new BepuPhysicsComponent(this, box); this.AttachComponent(bepuPhysicsComponent); // Create the Respawnable Component respawnableComponent = new RespawnableComponent(this, environment.Arena); this.AttachComponent(respawnableComponent); }
public override void Start() { this.bepuPhysicsComponent = (BepuPhysicsComponent)Parent.GetComponent("BepuPhysicsComponent"); }
public Item(Box box) { this.bepuPhysicsComponent = new BepuPhysicsComponent(this, box); this.AttachComponent(bepuPhysicsComponent); }