Vehicle dificults

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
velhonavio
Posts: 1
Joined: Tue Oct 26, 2010 11:16 am

Vehicle dificults

Post by velhonavio »

Good morning
I am having some problems on create a vehicle that works ...
In my test it is jumping so strange ...
Anyone have any simple example or some material that explains about the creation and the parameters of the vehicle..

Tks...
Arthur
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Vehicle dificults

Post by Norbo »

I would recommend looking at the VehicleInput.cs class in the BEPUphysicsDemos source to see how it is set up. Every property has associated XML documentation that should show up through intellisense.

In the constructor of the VehicleInput, you can see how the body of the vehicle is made, followed by four wheels which are added to the vehicle.

Each wheel is constructed from 5 parts- wheel shape, suspension, motor, brake, and sliding friction. Using the initialization shown in the VehicleInput is a good starting point; you can tune it further to achieve your desired vehicle type. To show how it can be changed, the TankInput.cs class contains a heavily modified version of the VehicleInput that behaves more like a tank.

That said, 'jumping' behavior is usually caused by floating point precision issues. A common cause is using a mesh with two massive individual triangles to emulate a plane. The collision detection system won't be able to handle that kind of size and collisions/some queries can look strange. The engine likes individual shapes in the 0.5-10 units range. It can handle values outside of that, but staying within that soft range is very safe.
Machei
Posts: 8
Joined: Tue Nov 02, 2010 12:04 am

Re: Vehicle dificults

Post by Machei »

Hi , here so i am new user and student , amatour about XNA :P . I was looking that this BEPU is interesing.

At now i will explain about my problems , that vehicle (unless wheles - trying test) doesnt work but he cant be created (i mean about body's vehicle) by my code in class LoadContent :

Code: Select all

            var body = new CompoundBody();
            body.AddBody(new Box(new Vector3(0, 0, 0), 2.5f, .75f, 4.5f, 60));
            body.AddBody(new Box(new Vector3(0, .75f / 2 + .3f / 2, .5f), 2.5f, .3f, 2f, 1));
            body.CenterOfMassOffset = new Vector3(0, -.5f, 0);
            body.TeleportTo(new Vector3(0, 0, 0)); //At first, just keep it out of the way.
            Vehicle = new Vehicle(body);

            space.Add(Vehicle);

            //    Camera.UseMovementControls = false;
            //Put the vehicle where the camera is.
            Vehicle.Body.TeleportTo(Vector3.Zero);
            Vehicle.Body.LinearVelocity = Vector3.Zero;
            Vehicle.Body.AngularVelocity = Vector3.Zero;
            Vehicle.Body.OrientationQuaternion = Quaternion.Identity;
result: No errors, Nothing hasnt be showed. So why?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Vehicle dificults

Post by Norbo »

That will put the vehicle and its body into the space, but without something to render it, it will be invisible. This may be what you are encountering.

Additionally, it may just fall into the abyss if you haven't set up an environment.

I would recommend working on the rendering and physics separately- first ensure that there's a working rendering system of some kind, and then work on some simulations. Working on the two simultaneously can cause some confusion, and once your rendering system is working, it will help visualize the simulation. The BEPUphysicsDrawer (in the demos) can help verify your renderer's accuracy when it comes to physical objects too, though I don't recommend using the BEPUphysicsDrawer for a game's renderer (it's a debugging and visualization system only).

If you are putting that into the BEPUphysicsDemos, study how the simulations are set up. Putting something directly into the Game's LoadContent method will likely be cleared out and replaced by whatever simulation comes up. The proper place to put simulation code in the BEPUphysicsDemos source is in individual Demo classes' constuctors.
Machei
Posts: 8
Joined: Tue Nov 02, 2010 12:04 am

Re: Vehicle dificults

Post by Machei »

Any project BEPUphysicsDrawer for XNA 4.0 there ? I have a project with XNA 3.1 but he has many errors with XNA 4.0 newest version.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Vehicle dificults

Post by Norbo »

Here's the prototype:
http://www.bepu-games.com/forums/viewto ... ?f=4&t=980

Edit:
There's also the BEPUphysicsPhoneDemo, which has a slightly different version on the downloads section of the website: http://www.bepu-games.com/BEPUphysics/downloads.htm
Post Reply