Honestly not as simple as it looks! What this does is fire a ray, using SU's raytest function. If you can understand the code (In the floor's onTick, look at the ruby docs for info on raytest), you should be able to use the basic system in your own models. In this example, I use thruster objects, tied by name to their 'parent' objects, that always face the firing system. They thrust the object away when they're hit, but this isn't the only thing you could do... set something to explode when hit, reduce a 'health' variable... it could also be used to find out if something's in line of sight, the distance to a point (rather than an object) and maybe create a laser effect. CONTROLS: Right stick=aim, rb/space=fire (Hold it down) #demo #firing #gun #physics #ray_gun #raycast #raytest #sketchyphysics #Wacov #weapon #working
- Comments