Im being working around the cannon-es example of an FPS game, but i want the ball have 0 mass so the ball go straight to where you shoot.
This is the example:
Cannon-es Threejs FPS
I cannot make it to work so if someone have any help will be appreciated.
Setting mass 0 in CannonJS means that the cannon body will remain static within the physics world. You can still move the threejs mesh by changing its position, and then copy the meshes new position over to the cannon body before every cannon update and scene render.
if you want no gravity, but still collisions, make sure your bullets have mass, but set world gravity to 0,0,0
const world = new CANNON.World();
world.gravity.set(0, 0, 0);
You can modify the appearance of gravity of a specific cannon body by using the cannon worlds
See lines 63-69 in this example below. For each bullet body in the scene, I apply a force equal to minus the worlds gravity so they don’t fall back to earth. The green boxes still comply with the worlds gravity setting and fall over to settle on the ground.