pmndrs / use-cannon

👋💣 physics based hooks for @react-three/fiber
https://cannon.pmnd.rs
2.74k stars 153 forks source link

Fix RaycastVehicle example #319

Closed marcofugaro closed 2 years ago

marcofugaro commented 2 years ago

Fixes #300

https://user-images.githubusercontent.com/7217420/147679112-a19e5816-ee9f-4907-acdc-e57a7014de9a.mov

Currently, the wheels in the useRaycastVehicle are orientated up (the debugger in #300 shows correctly what's going on).

This is because from v0.10.0 of cannon-es, the cylinder is created vertically, just like in three.js. So you need to rotate the cylinder by -Math.PI / 2 to put it horizontally. I did this via useCompoundBody.

Also, the indexRightAxis, indexForwardAxis, indexUpAxis order was somehow messed up, it has to reflect the values set here.

The || operator had an issue as well, it would result in falsy if 0 was passed.

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pmndrs/use-cannon/CNq2DFLLj63akpzrKHPzm8oTF9oM
✅ Preview: https://use-cannon-git-fix-raycastvehicle-pmndrs.vercel.app

drcmda commented 2 years ago

awesome @marcofugaro does this need a major? would you push to npm?

marcofugaro commented 2 years ago

No major haha, this is just a small bugfix in the src folder and other fixes in the examples.

I'll let the maintainers publish a patch version when they can.

drcmda commented 2 years ago

No major haha, this is just a small bugfix in the src folder and other fixes in the examples.

I'll let the maintainers publish a patch version when they can.

i just checked you are a maintainer with full rights including npm :D

i'll make a patch release