Offroad vehicle


#1

Here, https://github.com/Lumak/Urho3D-Offroad-Vehicle/

To Build

To build it, unzip/drop the repository into your Urho3D/ folder and build it the same way as you’d build the default Samples that comes with Urho3D.

I hope everyone can see the emphasis^ :slight_smile:

screenshot

Let me know if I missed anything, thx.

Edit: added instruction on how to build it.


Raycast vehicle
Build any road curve from a road section
#2

Great example!
I use Urho3D because of its excellent document and plenty of useful examples.
Most important, it is one alive project.
I had used GamePlay engine before, but it is almost dead now.
To keep an engine alive, the best way is using it to do some actual projects.


#3

awesome work Lumak!


#4

@artgolf, Thx, I’m also familiar with GamePlay. I’ve played around with that for a day then I discovered Urho3D :slight_smile: But I agree, ppl making projects out of the engine is a good way to keep it alive.

@rasteron, thx, I hope you find it useful.


#5

Can’t seem to be able to compile. I’m getting some undefined errors. Related to the changes made to Bullet. Perhaps I need to do a clean build.

Also, what version of Urho is this for, 1.6 release? I used the last one from the repository.


#6

@SLC, it is 1.6. I think I sync’d to the head about two weeks ago.

My first guess for the Bullet compile errors is that you only grabbed the files in 63_OffroadVehicle folder? There are source/header files in Source/ThirdParty/Bullet and Source/Urho3D folders that are in the repo.


#7

Nah. I actually copied and overwrote everything that was in the source folder. But I’ll try a clean build and if the problem still persists.


#8

For my testing, I drop the repo into a virgin urho3d 1.6 folder and do the build to ensure all source, header, and data are copied.
But on an existing built folder, I imagine the changes in the header files from the repo would require a rebuild if the dependency make files didn’t pick it up automatically.

Good luck with the build and let me know how it turns out.


#9

Nice, physics seems sweet in video, I’ll test it soon.
thanks


#10

Looks like it works very well!

If anyone is looking for a video:


#11

Made changes in the repo to access and scale compound local AABB to allows changing the inertia bbox and reduce the chance of rolling when aabb.y is reduced.

About the video, the dust emitters are not properly placed and were corrected in the repo, but I kinda like how it looks in the video :wink:

Merry Christmas :slight_smile:

edit: keeping positive attitude toward the holidays


#12

Found a bug with the offroad vehicle code. The problem appears when vehicle node is destroyed, raycast vehicle is not removed from the physics world and in the next physics step update application crashes.

To fix this you need to change

RaycastVehicle::~RaycastVehicle() { if (sphShape_) { delete sphShape_; sphShape_ = NULL; } if (vehicleRaycaster_) { delete vehicleRaycaster_; vehicleRaycaster_ = NULL; } if (raycastVehicle_) { delete raycastVehicle_; raycastVehicle_ = NULL; } }

to

RaycastVehicle::~RaycastVehicle() { if (sphShape_) { delete sphShape_; sphShape_ = NULL; } if (vehicleRaycaster_) { delete vehicleRaycaster_; vehicleRaycaster_ = NULL; } if (raycastVehicle_) { btDynamicsWorld *pbtDynWorld = (btDynamicsWorld*)GetPhysicsWorld()->GetWorld(); pbtDynWorld->removeVehicle(raycastVehicle_); delete raycastVehicle_; raycastVehicle_ = NULL; } }


#13

Ok, thanks. This crash doesn’t appear in Windows, which os?

edit: this makes sense if the game continues to run after a vehicle is removed. good find, thx.


#14

[quote=“Lumak”]Ok, thanks. This crash doesn’t appear in Windows, which os?

edit: this makes sense if the game continues to run after a vehicle is removed. good find, thx.[/quote]

I used Windows. But anyway, great sample! Managed to get this to work without any problems! :wink: