Vehicle Physics


This line of code is throwing an error

this.carChassis = localCreateRigidBody(100, tr, compound);

“localCreateRigidBody is not defined”

I am looking through the code but have yet to notice a bug.

BTW, awesome job so far! I honestly think solving this problem could be very beneficial to the community.


Okay fixed that error, it should have been
this.carChassis = this.localCreateRigidBody(100, tr, compound);
Now for the next error!


Ok nice! maybe we can work on this on the same project?
EDIT: Also this is the next error this.body.setContactProcessingThreshold(1000000.0);


Hey check it out


launched game

The script is running but the wheels aren’t showing?


Yeah I’m stuck with this one, it appears the wheels are rendering but their positions are all wrong and they don’t have collisions applied.


The graphical position of the wheels confuses me on line 414 as I had to scale up the local position for each wheel which makes no sense to me. But it works :thinking:

Edit: Ported the camera and also fixed up the materials so they look the same as the original project.


So I loaded in my own model, but the wheels of the model are rotating on the wrong axis it seems. They are flipping over themselves instead of spinning like a normal wheel. I am using the code above posted by yaustar.

Any ideas?


You are going to have to look over the vehicle code as there quite a few things that were specific to that model that was originally used.


Can you point me in the right direction? I was messing around with this code to no success.

this.pos.set(p.x(), p.y(), p.z());
this.quat.set(q.x(), q.y(), q.z(), q.w());


You can change the orientation of your vehicle in a 3D tool like blender


I changed the orientation from y-axis up to z-axis up to no difference.


Figured it out! Thanks for help all


Let us know if there is something to test…