n5ro / aframe-physics-system

Physics system for A-Frame VR, built on CANNON.js.

Home Page:https://n5ro.github.io/aframe-physics-system/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make the fired balls go through a Crosshairs/Aimer

knightMash opened this issue · comments

Hey @donmccurdy , This is more like a question and not a issue with the library(which is awesome though).
I am trying to create a simple first person shooter simulator. I have a blue box depicting GUN and a pink ball depicting CROSSHAIRS or Aimer and a simple box as target.

I was aiming to fire the balls through the Crosshairs/Aimer to the target(Box). But right now whenever I fire the ball it goes in random directions. The problem is more visible when you drag and rotate/ move the screen. Here is a glitch as a demo.

Can you please suggest what can I do to make each ball fired go through the Crosshairs and then go beyond it to hit the target if any? It would be a big help.

You probably don't want to use a physics engine for fast-moving projectiles, like in an FPS game. Most physics engines are not precise enough for very small, very fast objects. It would be better to use something like THREE.Raycaster instead, and then you have much more control over the projectile and the hitboxes.

Thanks for replying @donmccurdy , It does help.