Vehicle Physics


#21

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.


#22

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


#23

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


#24

Hey check it out
editor

Launch:

launched game

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


#25

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.


#26

https://playcanvas.com/editor/scene/749274

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.


#27

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?


#28

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.


#29

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());

#30

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


#31

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


#32

Figured it out! Thanks for help all


#33

Let us know if there is something to test…