Is it possible to do "volumetric" ray casting?
Hello, In my game, I have ray casting set up using the single channel trace. I'll be using this for casting actual rays as spells. Since rays obviously have no volume, this is pinpoint accurate for hitting enemies. While this technically works, being pinpoint accurate is not as user friendly as I would like. I'm looking for a way to do the equivalent of ray casting, but as an elongated box to give the player a little more leeway with aiming and hitting enemies (like a really fat ray). If I simply had a box for collision jutting out from the player, that would either block everything it hit (definitely not desirable) or I could overlap, but collision checks wouldn't go "out" in a direction like a ray cast does and wouldn't stop when it first hits something. Does anyone know of a way I could go about getting the effect I'm looking for? Thank you.
P.S. I write everything in C++ and I don't use blueprints.
asked Oct 26 '16 at 02:29 AM in C++ Programming
Yes, this is possible. It is called a Sphere trace. I have never done it in Blueprints myself, but Rama has a very good answer that you can use: https://answers.unrealengine.com/questions/130430/how-to-make-a-sphere-trace.html
answered Oct 26 '16 at 02:40 AM
You could also do 4 (or any number) of ray casts that are close to each other in parallel. If any one of them hit the target, count it as a hit. In this way, if the target is partially behind something and hence blocked by one ray cast, they can still be hit by the others - you would not get this in a sphere ray cast.
answered Oct 27 '16 at 07:17 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here