Created
November 24, 2022 05:20
-
-
Save flushpot1125/dc8cc6f8d4be8cb4aac3d090cd0b3def to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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