As norbo has said the rendering system in bepu is pretty much for debugging physics only.
You need to go to the xna website and download the chase camera which will should you how to make a proper working camera and render models using xna.
Once you have that you can then add bepu physics to that project with ease. But just remember that 3d physics are not an easy task (expessially cars etc...) to add to a game.
Custom car fbx model
-
- Posts: 17
- Joined: Thu Aug 12, 2010 5:58 am
Re: Custom car fbx model
thanks man...Debugging is exacting what i want to do. I already have a debug camera the only problem i'm having now is to resolve the entity.worldmatrix. I get this message System.NullReferenceException was unhandled Message=NullReferenceException at the "worldmatrix" line when I debug.
Code: Select all
public Car(Game game, Vector3 position)
{
worldMatrix = entity.WorldTransform * offsetTransform;
Re: Custom car fbx model
If it is happening on that line, it means the entity reference you're using is null. Make sure it actually receives a value before it gets used.
Usually, I or others will refer people to the BEPUphysics forums for help with the actual physics engine since it's a specialized topic. However, other places are much better for learning C# or game development in general. Also, learning game development at the same time as a 3d physics engine might be a little tricky
Usually, I or others will refer people to the BEPUphysics forums for help with the actual physics engine since it's a specialized topic. However, other places are much better for learning C# or game development in general. Also, learning game development at the same time as a 3d physics engine might be a little tricky
-
- Posts: 17
- Joined: Thu Aug 12, 2010 5:58 am
Re: Custom car fbx model
so what kind of values does entity receive?
Re: Custom car fbx model
The field 'entity' refers to some Entity object, or null. If it is never assigned to an actual object of type Entity, it will refer to null. If the field is used while referring to null, you get a null reference exception.
This is a pretty simple programming problem. If you narrow your scope a bit so that you take one step at a time, the learning process would be a lot easier.
This is a pretty simple programming problem. If you narrow your scope a bit so that you take one step at a time, the learning process would be a lot easier.
Re: Custom car fbx model
Hey, I have a related question:
I got the wheels to render in their correct locations and with the help of the physicsDemos got the back 2 to start spinning, but they do it in the wrong direction, perpendicular to the car.
Code I used to create the wheels,:
Also I know this isn't what this forum is for, but if you could help me it would be nice; my models are too small for the terrain I've created. I've tried using Matrix.CreateScale() to scale the worldMatrix on each mesh, but nothing happens.
Thanks in advance, and thanks for the engine.
I got the wheels to render in their correct locations and with the help of the physicsDemos got the back 2 to start spinning, but they do it in the wrong direction, perpendicular to the car.
Code I used to create the wheels,:
Code: Select all
Matrix wheelGraphicRotation = Matrix.CreateFromAxisAngle(Vector3.Forward, MathHelper.PiOver2);
car.AddWheel(new Wheel(
new RaycastWheelShape(.375f, wheelGraphicRotation),
new WheelSuspension(2000, 100f, Vector3.Down, .8f, new Vector3(-1.8f, 0.5f, 1f)),
new WheelDrivingMotor(2.5f, 30000, 10000),
new WheelBrake(1.5f, 2, .02f),
new WheelSlidingFriction(4, 5)));
car.AddWheel(new Wheel(
new RaycastWheelShape(.375f, Matrix.CreateRotationY(MathHelper.Pi)),
new WheelSuspension(2000, 100f, Vector3.Down, .8f, new Vector3(-1.8f, 0.5f, -1f)),
new WheelDrivingMotor(2.5f, 30000, 10000),
new WheelBrake(1.5f, 2, .02f),
new WheelSlidingFriction(4, 5)));
car.AddWheel(new Wheel(
new RaycastWheelShape(.375f, wheelGraphicRotation),
new WheelSuspension(2000, 100f, Vector3.Down, .8f, new Vector3(1.8f, 0.5f, 1f)),
new WheelDrivingMotor(2.5f, 30000, 10000),
new WheelBrake(1.5f, 2, .02f),
new WheelSlidingFriction(4, 5)));
car.AddWheel(new Wheel(
new RaycastWheelShape(.375f, Matrix.CreateRotationY(MathHelper.Pi)),
new WheelSuspension(2000, 100f, Vector3.Down, .8f, new Vector3(1.8f, 0.5f, -1f)),
new WheelDrivingMotor(2.5f, 30000, 10000),
new WheelBrake(1.5f, 2, .02f),
new WheelSlidingFriction(4, 5)));
Thanks in advance, and thanks for the engine.
Re: Custom car fbx model
It sounds like the local graphic transform is just incorrect. The purpose of the local transform is to get some arbitrary model (which could be set up in any way) to match the local space transform of the 'real' wheel. If it doesn't actually match the local space shape, it will spin in incorrect ways.but they do it in the wrong direction, perpendicular to the car.
If you want a make a wheel that drives in a different direction, change the wheel's LocalForwardDirection.
If nothing happens, then the transform was applied either to the wrong thing or at the wrong time. Make sure it's not being overwritten later. Follow the execution from your initial transformation through until it draws wrong and analyze each step to see if it matches your expectations. If it doesn't, then there's a good starting point for further debugging.my models are too small for the terrain I've created. I've tried using Matrix.CreateScale() to scale the worldMatrix on each mesh, but nothing happens.