@BluePrintRandom - The reason raycasts are generally done for bullets is because the physics engine doesn’t deal with very small objects well at all. If you use small physics-enabled bullets, they can slip through objects and go places they shouldn’t. With raycasts, they’re efficient (enough, at least) and accurate.
@cam.dudes - Yeah, I did. I don’t usually do FPS or TPS games, so I have limited experience with it, though. Something like this should work, though:
impulse = -ray#rayhit.worldPosition - obj.worldPosition
impulse.magnitude = 0.5
rayobj.applyImpulse([0, 0, 0], impulse )
Ray is the third argument of a variable containing the result of a rayCast() function (the returned hit normal). With this, the object would get a pretty slight impulse in the opposite of the hit normal. If that doesn’t give you the result you’re looking for, you could also try rayhit.worldPosition - obj.worldPosition, as it’s commented out above. That would push the object in the direction of where you shot to where the object is. The most accurate would be to imply a forward vector impulse at the point where the bullet hits (which is set to [0, 0, 0] above), I think. Check the applyImpulse() API call for more info.