So the problem i am working with here is about rays piercing objects. Basically, a ray is created, it hits a piece of armor, and then some math happens, if it is able to pierce the armor, then I need it to create a ray just past it, moving in the same direction. Ive already figured out the math for if it can pierce the armor, I think i can figure out the direction part, i just need to know how to offset the position. I dont think i can just add an x or y constant variable for this reason:
The green is the initial shot, and the blue is the second ray that needs to be created. If its hitting like this, its pretty easy, you would just offset the starting position of the ray by a little bit on the x axis. But it might not always hit like that. What if it hits like one of these:
I accidentally inverted the colors of the rays but my point still stands.
I cant just add an x value to the starting point of both of those secondary rays. For one, it would work alright, but the other, that would put it back outside of the armor and just hit it twice. And this project is in 3d, so there's a z coordinate to deal with as well. What i would need to do is add a value to the origin of the secondary ray that is a few units forward of the first ray's eventual impact point. And that is what I can't figure out how to do.