Im trying to figure out how to make a missile/ unit reflect off of a wall or no walk zone when te hit it. I know how to make a unit check for these zones, but I'm having trouble making a way for the unit to bounce off at the mirrored angle of its impact.
Missile hits a perpendicular wall at 60 degrees, negate the impact and add 360 = 300 degree facing distance after impact.
The equation would be different for each wall angle (45, 180, 90 etc).
If no one can think of a way to do this, another thing that I would like to know how to do/ would help me would be a function that returns the angle of the wall hit.
Please help, other threads have been too advanced for me to follow...
A way around this is to reverse their direction when they hit within the wall region... I'm pretty sure this can be done another way, I think it had to do with some no-air data, I don't actually remember ._. , I'll try to look into that.
Ya I would need to reshoot the missile, and that's easy enough to do through triggers, but I need a way to get the point the missile needs to target.
People have said they have used the normal of the wall to calculate this, but
1. I don't know how to find the normal of a plane/triangle 2. Idk how to find the points of this "triangle" on the wall. :(
AS FOR THAT, you would need several points and a lot of variables.
Anyway, put points in all possible targets and if a certain point is make the invis dummy hit in the direction of another point in the opposite direction...
If the missile is from a unit in a different angle, try using some real variables to determine the units angle and direction from the point, and use the else-if statement to hit different points from different angles if needed.
I don't really know, I never thought of this before, but just curious, what kind of map/mod/campaign/etc, are you making with this?
That's great, and yes, we just need a way to get the angle of the cliff. The guy in the forum you linked me to said he made units that represent the angle of the wall... Wouldn't it be simpler to just use his way of getting the angle of the wall? I mean how does he find the angle of the wall? He finds it at some point so he can set the units facing equal to the wall's facing, I that makes any sense... xD
I'm trying to recreate the wii tanks game xD I also have some other ideas for using the missile deflection system though as well.
I found a way to do it, it's kinda sketchy, and it doesn't work for diagonal walls (yet).
Here is what I did:
I gave my unit a validator that checks for path able terrain, then I have it trigger a dummy effect, and in triggers I check 8 points at 45 degree intervals around the impact point to see which of these points is path able. Then I set a variable for that point to true if it is path able. Once I know which points are path able, it's easy to find the normal of the wall from the points that returned pathable. :)
This can be done with regions too by checking if the point is in the region instead of if it's pathable.