Skip to content

Instantly share code, notes, and snippets.

@flushpot1125
Created November 24, 2022 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flushpot1125/dc8cc6f8d4be8cb4aac3d090cd0b3def to your computer and use it in GitHub Desktop.
Save flushpot1125/dc8cc6f8d4be8cb4aac3d090cd0b3def to your computer and use it in GitHub Desktop.
function shoot () {
const ballInstance = bullet.createInstance("ballInstance");
ballInstance.position.copyFrom(reticle.getAbsolutePosition());
ballInstance.physicsImpostor = new BABYLON.PhysicsImpostor(ballInstance, BABYLON.PhysicsImpostor.SphereImpostor, { mass: 1, friction: 0.2, restitution: 0.2 });
ballInstance.applyImpulse(ray.direction.scale(impulseMagnitude), bullet.getAbsolutePosition().add(contactLocalRefPoint));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment