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.
Example:
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...
I think it isn't possible to change the target of flying missiles.
You should try to destroy the missile on impact, create an invisible dummy unit for the owner of that missile and let it shoot the same missile again, in another direction.
Cliff normals:
South = 0 / 360
East = 90
North = 180
West = 270
Formula: Outgoing Angle = Incoming Angle - 2*(Incoming Angle - normal of the wall) Example: Outgoing Angle = 150 - 2*(150 - 180) = 210
(missile hits the cliff from south to north)
The incoming angle is the missile units facing angle (150° in this example).
The normal of the wall is one of those angle values at the start of my post. :)
(don't forget the diagonal values)
So far so good, but now we still need a way to get the information which cliff type the missile actually hit :P
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've read a few forums where people calculate the normal by getting 3 points on the cliff face near the impact... But idk how to get these points or calculate the normal, so I'm stuck xD
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.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
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.
Example: 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...
Bump
I think it isn't possible to change the target of flying missiles.
You should try to destroy the missile on impact, create an invisible dummy unit for the owner of that missile and let it shoot the same missile again, in another direction.
I dunno how to get the correct angle, tho :(
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. :(
@Oparcus: Go
http://www.sc2mapster.com/forums/development/triggers/11699-perfect-wall-bouncing-system/
maybe this can help?^^
I'm not good enough at math to follow this thread though... If you can break down what they are talking about it will help a ton, Ty :)
Cliff normals:
South = 0 / 360
East = 90
North = 180
West = 270
Formula: Outgoing Angle = Incoming Angle - 2*(Incoming Angle - normal of the wall)
Example: Outgoing Angle = 150 - 2*(150 - 180) = 210
(missile hits the cliff from south to north)
The incoming angle is the missile units facing angle (150° in this example).
The normal of the wall is one of those angle values at the start of my post. :)
(don't forget the diagonal values)
So far so good, but now we still need a way to get the information which cliff type the missile actually hit :P
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.
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?
http://www.sc2mapster.com/forums/resources/project-workplace/1403-reaper-madness-showcase-2-physics/
Atleast we know it's possible somehow (see those banelings? THEY'RE AWESOME!) :P
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.
@Ousnius: Go
The bumpy terrain looked like... something... and one of the banelings clutched it...
@Oparcus: Go
Wii Play Tanks....damn I guess that'd be funny in SC2 XD
Maybe there's some kind of formula to calculate those cliff normals and we're just too dumb for that.
Someone smart in here that can help? xD
I've read a few forums where people calculate the normal by getting 3 points on the cliff face near the impact... But idk how to get these points or calculate the normal, so I'm stuck xD
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.