Closed dunak-debug closed 3 years ago
https://stackoverflow.com/questions/67373047/cannon-js-raycast-vehicle-support-in-a-frame-wheel-visuals-bad-axis
All described in topic here
`
var vehicle = new CANNON.RaycastVehicle({ chassisBody: this.el.body, indexForwardAxis: 2, indexRightAxis: 0, indexUpAxis: 1 }); var wheelBodies = []; for(var i=0; i<vehicle.wheelInfos.length; i++){ var wheel = vehicle.wheelInfos[i]; var element = document.createElement("a-cylinder"); element.setAttribute("radius", wheel.radius); element.setAttribute("height", wheel.radius / 2); element.setAttribute("material", "src", `url(${Wheel})`); element.setAttribute("static-body", "mass", "1"); this.el.sceneEl.appendChild(element); wheelBodies.push(element); } // Update wheels this.world.addEventListener('postStep', function(){ for (var i = 0; i < vehicle.wheelInfos.length; i++) { vehicle.updateWheelTransform(i); var t = vehicle.wheelInfos[i].worldTransform; wheelBodies[i].body.position.copy(t.position); wheelBodies[i].body.quaternion.copy(t.quaternion); } });`
https://stackoverflow.com/questions/67373047/cannon-js-raycast-vehicle-support-in-a-frame-wheel-visuals-bad-axis
All described in topic here
`