I have managed after quite a few hours to get a car into the world and some debug rendering to view it. but it doesnt work if i throw a box at it ,it collides and moves the car around but i cannot drive it.
I have it on a static tri mesh for my world. I call the accelerate call on it with values of up to 10000000 but nothing happens. but if i throw a box at it i can see the wheels spin around... Oh also the car always seems to flip onto its back as if its completely round...
Also the new licenceing fees seem quite good, this will be my first game using bepu (but my 5th game in total) my previous games have made about $35,000 all up now and i expect this one to make around 15K - 25K and was just wondering do i have to do anything special before the game is released (not for 3 months) or once its out i just contact you and give you your cut? Im just wondering, thats all. I have a team of 4 and we just wanted to know.
Also what new features are coming in the next version? A list of whats to come would be great
Anyway i hope you can help me out with my car code its really frustrating...
CODE IS BELOW :
Code: Select all
private List<Wheel> TestWheels;
private List<Box> TestWheelBodys;
private Box TestCarBody;
Vehicle TestCar;
public MainGame()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
//Test Car Stuff
TestCarBody = new Box(g_Camera3D.GET.Position, 1.8f, 0.8f, 3.0f, 40);
TestWheelBodys = new List<Box>();
TestWheelBodys.Add(new Box(g_Camera3D.GET.Position, 1, 1, 1, 10));
Quaternion initialWheelRotation = Quaternion.CreateFromAxisAngle(Vector3.Forward, (float)Math.PI / 2);
TestWheels = new List<Wheel>();
//Front left wheel
TestWheels.Add(new ConvexCastWheel(new Vector3(-3, -0.5, 3.3f), initialWheelRotation, TestWheelBodys[0], 1, new Vector3(0, -1, 0), new Vector3(0, 0, 1), .6f, .7f, .8f, .2f, 2.5f, 1000, .8f));
//Front right wheel
TestWheels.Add(new ConvexCastWheel(new Vector3(3, -0.5, 3.3f), initialWheelRotation, TestWheelBodys[0], 1, new Vector3(0, -1, 0), new Vector3(0, 0, 1), .6f, .7f, .8f, .2f, 2.5f, 1000, .8f));
//Back left wheel
TestWheels.Add(new ConvexCastWheel(new Vector3(-3, -0.5, -3.3f), initialWheelRotation, TestWheelBodys[0], 1, new Vector3(0, -1, 0), new Vector3(0, 0, 1), .6f, .7f, .8f, .2f, 2.5f, 1000, .8f));
//back right wheel
TestWheels.Add(new ConvexCastWheel(new Vector3(3, -0.5, -3.3f), initialWheelRotation, TestWheelBodys[0], 1, new Vector3(0, -1, 0), new Vector3(0, 0, 1), .6f, .7f, .8f, .2f, 2.5f, 1000, .8f));
TestCar = new Vehicle(TestCarBody, 30,10,TestWheels);
TestCar.moveTo(new Vector3(0,-100,0));
space.add(TestCar);
base.Initialize();
}
protected override void LoadContent()
{
Model model = Content.Load<Model>("Models/terrain");
Matrix objecttoworld = Matrix.CreateScale(1f)*Matrix.CreateTranslation(Vector3.Zero);
g_GameManager.GET.renderManager.SubmitRenderableObject(model, objecttoworld, ObjectVisibility.Rendered | ObjectVisibility.CastShadows, ObjectLifeSpan.Scene);
//-----------------
//Create a physical environment from a triangle mesh.
//First, collect the the mesh data from the model using a helper function.
//This special kind of vertex inherits from the TriangleMeshVertex and optionally includes
//friction/bounciness data.
//The StaticTriangleGroup requires that this special vertex type is used in lieu of a normal TriangleMeshVertex array.
StaticTriangleGroup.StaticTriangleGroupVertex[] vertices;
int[] indices;
StaticTriangleGroup.getVerticesAndIndicesFromModel(model, out vertices, out indices);
//Give the mesh information to a new TriangleMesh.
//TriangleMeshes are internally accelerated structures that
//help handle raycasts and various other queries on mesh data.
TriangleMesh triangleMesh = new TriangleMesh(vertices, indices);
//Create the StaticTriangleGroup based on the triangle mesh.
StaticTriangleGroup triangleGroup = new StaticTriangleGroup(triangleMesh) {worldMatrix = Matrix.CreateTranslation(new Vector3(0, 0, 0))};
//Add it to the space!
space.add(triangleGroup);
//-----------------
TheBox = Content.Load<Model>("Models/blend-deferred/Cube");
TheBoxMatrix = Matrix.CreateScale(4.0f)*Matrix.CreateTranslation(new Vector3(0.0f, 1f, 0.0f));
}
protected override void Update(GameTime in_GameTime)
{
TestCar.accelerate(0);
TestCar.releaseBrake();
if (g_Controller.GET.IsKeyHeld(Keys.F))
TestCar.accelerate(7);
//I have tried without these as well as i assumed that the space update did this...
TestCar.updateAtEndOfFrame(in_GameTime.ElapsedGameTime.Seconds, 1.0f, in_GameTime.ElapsedRealTime.Seconds);
TestCar.updateAtEndOfUpdate(in_GameTime.ElapsedGameTime.Seconds, 1.0f, in_GameTime.ElapsedRealTime.Seconds);
TheBoxMatrix = TestCar.wheels[0].worldMatrix;
RenderManager.SubmitObject(TheBox, TheBoxMatrix);
TheBoxMatrix = TestCar.wheels[1].worldMatrix;
RenderManager.SubmitObject(TheBox, TheBoxMatrix);
TheBoxMatrix = TestCar.wheels[2].worldMatrix;
RenderManager.SubmitObject(TheBox, TheBoxMatrix);
TheBoxMatrix = TestCar.wheels[3].worldMatrix;
RenderManager.SubmitObject(TheBox, TheBoxMatrix);
TheBoxMatrix = TestCarBody.worldTransform;
RenderManager.SubmitObject(TheBox, TheBoxMatrix);
g_GameManager.GET.space.update(in_GameTime);
base.Update(in_GameTime);
}