void fireBall() { BepuEntity ball = new BepuEntity(); ball.modelName = "sphere"; float size = 1; ball.localTransform = Matrix.CreateScale(new Vector3(size, size, size)); ball.body = new Sphere(Camera.pos + (Camera.look * 5), size, size); ball.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble()); space.Add(ball.body); ball.LoadContent(); ball.body.ApplyImpulse(Vector3.Zero, Camera.look * 50); children.Add(ball); }
public BepuEntity AddBox(Vector3 boxPosition) { BepuEntity body = new BepuEntity(); body.modelName = "cube"; body.LoadContent(); body.localTransform = Matrix.CreateScale(new Vector3(15, 5, 20)); body.body = new Box(new Vector3(260, 45, -260), 15, 5, 20); body.body.BecomeDynamic(100); body.body.CollisionInformation.LocalPosition = new Vector3(0, .8f, 0); body.diffuse = new Vector3(0.5f, 0.5f, 0.5f); Game1.Instance.Space.Add(body.body); Game1.Instance.Children.Add(body); return body; }
public BepuEntity AddBox(Vector3 boxPosition) { BepuEntity body = new BepuEntity(); body.modelName = "cube"; body.LoadContent(); body.localTransform = Matrix.CreateScale(new Vector3(15, 5, 20)); body.body = new Box(new Vector3(260, 45, -260), 15, 5, 20); body.body.BecomeDynamic(100); body.body.CollisionInformation.LocalPosition = new Vector3(0, .8f, 0); body.diffuse = new Vector3(0.5f, 0.5f, 0.5f); Game1.Instance.Space.Add(body.body); Game1.Instance.Children.Add(body); return(body); }
public Entity AddWheel(Vector3 wheelPosition, Entity baseBody) { BepuEntity wheel = new BepuEntity(); wheel.modelName = "cyl"; wheel.LoadContent(); wheel.body = new Cylinder(wheelPosition, 2, 2, 2); wheel.localTransform = Matrix.CreateScale(2f, 2f, 2f); wheel.body.Material.KineticFriction = 2.5f; wheel.body.Material.StaticFriction = 2.5f; wheel.body.Orientation = Quaternion.CreateFromAxisAngle(Vector3.Forward, MathHelper.PiOver2); wheel.diffuse = new Vector3(0, 0, 0); //Prevents collisionf from happening CollisionRules.AddRule(wheel.body, baseBody, CollisionRule.NoBroadPhase); //Add the wheel and connection to the space. Game1.Instance.Space.Add(wheel.body); Game1.Instance.Children.Add(wheel); return wheel.body; }
public Entity AddWheel(Vector3 wheelPosition, Entity baseBody) { BepuEntity wheel = new BepuEntity(); wheel.modelName = "cyl"; wheel.LoadContent(); wheel.body = new Cylinder(wheelPosition, 2, 2, 2); wheel.localTransform = Matrix.CreateScale(2f, 2f, 2f); wheel.body.Material.KineticFriction = 2.5f; wheel.body.Material.StaticFriction = 2.5f; wheel.body.Orientation = Quaternion.CreateFromAxisAngle(Vector3.Forward, MathHelper.PiOver2); wheel.diffuse = new Vector3(0, 0, 0); //Prevents collisionf from happening CollisionRules.AddRule(wheel.body, baseBody, CollisionRule.NoBroadPhase); //Add the wheel and connection to the space. Game1.Instance.Space.Add(wheel.body); Game1.Instance.Children.Add(wheel); return(wheel.body); }