Beispiel #1
0
 void setupPlane()
 {
     wings = new Cube(new Vector3(0f, 0f, 0.2f), 1, 0.2f, 0.125f, Color.Brown, graphic);
     body = new Cube(new Vector3(0, 0, 0), 0.125f, 1, 1, Color.Blue, graphic);
     tail = new Cube(new Vector3(0, 0.5f, -0.46f), 0.015f, 1.5f, 0.1f, Color.Green, graphic);
     c = new Cube(new Vector3(0, -0.4f, -0.45f), 0.3f, 0.1f, 0.1f, Color.Yellow, graphic);
 }
Beispiel #2
0
 public Box(GraphicsDevice graphic, Vector3 startupPos)
 {
     cube = new Cube(startupPos, 3, 3, 3, randomColor(), graphic);
     Body.Position = startupPos.ToVector3();
     HalfSize = new Vector3(1.5f, 1.5f, 1.5f).ToVector3();
     Body.Mass = 1.5f * 1.5f * 1.5f * 8.0f;
     Disque.Math.Matrix3 tensor = Disque.Math.Matrix3.Identity;
     tensor.SetBlockInertiaTensor(HalfSize, Body.Mass);
     Body.SetInertiaTensor(tensor);
     Body.LinearDrag = 0.95f;
     Body.AngularDrag = 0.8f;
     Body.ClearAccumulation();
     Body.Acceleration = Disque.Math.Vector3.SmallGravity;
     Body.SetCanSleep(false);
     Body.SetAwake();
     Body.CalculateDerivedData();
     CalculateInternals();
 }
Beispiel #3
0
 void addboat()
 {
     buoyancy = new Buoyancy(1.0f, 3.0f, 1.6f, 1000, new Disque.Math.Vector3(0, 0.5f, 0));
     sail = new Aero(new D.Matrix3(new float[]{ 0,0,0, 0,0,0, 0,0,-1.0f}), new D.Vector3(2.0f, 0, 0), windspeed);
     cube = new Cube(new Vector3(0, 30, 0), 3, 3, 3, Color.Blue, GraphicsDevice);
     drawables.Add(cube);
     body = new RigidBody();
     body.SetOrientation(new Disque.Math.Quaternion(1, 0, 0, 0));
     body.LinearDrag = 0.8f;
     body.AngularDrag = 0.8f;
     body.Position = new Disque.Math.Vector3(0, 1.6f, 0);
     body.Mass = 200;
     D.Matrix3 it = new D.Matrix3();
     it.SetBlockInertiaTensor(new D.Vector3(1.5f, 1.5f, 1.5f), 100.0f);
     body.BoundingSphere = new D.BoundingSphere(body.Position, 1.5f);
     body.SetInertiaTensor(it);
     body.CalculateDerivedData();
     body.SetAwake();
     body.SetCanSleep(true);
     body.ForceGenerators.Add(buoyancy);
     body.ForceGenerators.Add(sail);
     rbw.RigidBodies.Add(body);
 }