Vehicle Sample

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Stevemata
Posts: 33
Joined: Sat Mar 17, 2012 11:11 pm

Vehicle Sample

Post by Stevemata »

The vehicle sample is broken in fork v4.0.30319

I have gone through and corrected the variable name changes, but I'm getting all sorts of other errors. Is there a fixed version?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Vehicle Sample

Post by Norbo »

I'm not sure what fork you mean- as far as I'm aware, all the nondevelopment forks I manage should compile without errors.

Occasionally, the development version won't compile for the Xbox360 (usually due to my prototypes ignoring XBox360 Vector3 initialization details), but the very latest one I just put up there works. The latest development version can always be found here: http://bepuphysics.codeplex.com/SourceC ... evelopment

Edit:
v4.0.30319 refers to a .NET framework version. If you see errors related to that, some references probably got messed up somewhere.
Stevemata
Posts: 33
Joined: Sat Mar 17, 2012 11:11 pm

Re: Vehicle Sample

Post by Stevemata »

My mistake, that's two for me today. I updated my references with the latest developer build and demos, it's working much better :)
Stevemata
Posts: 33
Joined: Sat Mar 17, 2012 11:11 pm

Re: Vehicle Sample

Post by Stevemata »

I have the model drawer drawing the vehicles wheels, how do I get the modeldrawer to draw the vehicle's body?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Vehicle Sample

Post by Norbo »

Add the vehicle's body entity to the ModelDrawer. In the BEPUphysicsDemos, there's a loop that runs after the demo is constructed which adds all entities in the Space.Entities list to the ModelDrawer; that's why there's no explicit add in the VehicleInput.
Stevemata
Posts: 33
Joined: Sat Mar 17, 2012 11:11 pm

Re: Vehicle Sample

Post by Stevemata »

I added all of my entities to the model drawer, I'm still only getting the wheels. Is there some other setting to make sure the models are drawn?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Vehicle Sample

Post by Norbo »

Make sure the ModelDrawer.Update and ModelDrawer.Draw methods are both called properly. It's possible for special case models like vehicle wheels to draw properly without a ModelDrawer.Update, but the entity representations won't.
Stevemata
Posts: 33
Joined: Sat Mar 17, 2012 11:11 pm

Re: Vehicle Sample

Post by Stevemata »

Oh my, yeah no modeldrawer.update... that was it.
Stevemata
Posts: 33
Joined: Sat Mar 17, 2012 11:11 pm

Re: Vehicle Sample

Post by Stevemata »

I'm attempting to replace the default wheel with a custom wheel, what world matrix transformation does the modeldrawer use to draw the wheels in the vehicle sample?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Vehicle Sample

Post by Norbo »

The wheel shape exposes a world transform. From the VehicleInput update:

Code: Select all

            for (int k = 0; k < 4; k++)
            {
                WheelModels[k].WorldTransform = Vehicle.Wheels[k].Shape.WorldTransform;
            }
There will also likely be some local transform that is required to bring the wheel model into alignment with the wheel shape prior to applying the world transform.
Post Reply