nartc / angular-three

🧊 THREE.js integration for Angular 🧊
https://angular-three.netlify.app/
MIT License
306 stars 26 forks source link

[Bug] useRaycastVehicle property name mismatch #120

Closed IRobot1 closed 2 years ago

IRobot1 commented 2 years ago

After converting the cannon Raycast Vehicle example to NGT, I've been trying to figure out why the wheels won't rotate.

NGT useRaycastVehicle has the following code

            worker.addRaycastVehicle({
              props: [chassisBodyUUID, wheelUUIDs, wheelInfos, indexForwardAxis, indexRightAxis, indexUpAxis],
              uuid,
            });

The corresponding code in cannon worker implementation of addRaycastVehicle

  const [chassisBody, wheels, wheelInfos, indexForwardAxis, indexRightAxis, indexUpAxis] = data.prop

Its expecting the first property to be called chassisBody, not chassisBodyUUID and the second property to be wheels, not wheelUUIDs.

Do you agree?

nartc commented 2 years ago

It is an array so it does not matter.

IRobot1 commented 2 years ago

I'll work on an example in NGT examples to see if I can figure out what's going on.

IRobot1 commented 2 years ago

What's the command line to run the sandbox to test changes?

IRobot1 commented 2 years ago

cd app/sandbox nx serve

nartc commented 2 years ago

npx nx serve sandbox

IRobot1 commented 2 years ago

I've tracked it down to this code in raycast-vehicle.ts

          this.effect<[CannonWorkerAPI, THREE.Object3D]>(
              tapEffect(() => {

tapEffect isn't getting called.

nartc commented 2 years ago

how are you using useRaycastVehicle?

IRobot1 commented 2 years ago

Figured it out. Need to pass false to indicate its not used in the template.

It currently looks more like a duck paddling than a card image

nartc commented 2 years ago

There was indeed a bug which I released a fix in the latest version. Also check out https://github.com/nartc/angular-three/tree/main/apps/sandbox/src/app/raycast-vehicle

nartc commented 2 years ago

@IRobot1 have you been able to recreate the raycastVehicle example?

IRobot1 commented 2 years ago

Raycast Vehicle Physics Example now working

image