So the issue i’m working with right here is about rays piercing objects. Mainly, a ray is created, it hits a bit of armor, after which some math occurs, if it is ready to pierce the armor, then I want it to create a ray simply previous it, transferring in the identical course. Ive already found out the maths for if it might probably pierce the armor, I believe i can determine the course half, i simply must know how one can offset the place. I dont suppose i can simply add an x or y fixed variable because of this:
The inexperienced is the preliminary shot, and the blue is the second ray that must be created. If its hitting like this, its fairly straightforward, you’ll simply offset the beginning place of the ray by somewhat bit on the x axis. But it surely won’t at all times hit like that. What if it hits like one among these: I by chance inverted the colours of the rays however my level nonetheless stands.
I cant simply add an x worth to the start line of each of these secondary rays. For one, it will work alright, however the different, that might put it again exterior of the armor and simply hit it twice. And this venture is in 3d, so there is a z coordinate to take care of as nicely. What i would wish to do is add a worth to the origin of the secondary ray that could be a few models ahead of the primary ray’s eventual affect level. And that’s what I can not determine how one can do.