Line of Sight Checker(Bullet Immitator)
not ratedThis checks to see if a line between 2(3-Dimensional) points would ever intersect into the terrain of a map(Not the dodadds, just the ground including platform heights), if the line would intersect into the terrain, if you choose to save, it will save the FIRST point of intersection, and then the 2 functions GetSavedImpactHeight and GetSavedImpactLocation will give you these values(GetSavedImpactLocation will create a new location object, and yes I know GetSavedImpactHeight is pointless)
Hopefully I didn't mess anything up when I changed a few lines that were different because of my specific game(They were there in bad programming habit anyways).
This will not find if a dodadd or other obstacles are intersecting the line, but I do have a method of achieving this but it is a bit messy and its as efficient as it could be or cleanly versatile yet(Versatile meaning working outside of just my one game), after I clean that code up a bit I might post.
Bullet Immitator-
Since I call it a bullet immitator I might as well explain myself, The basic idea is you have the position of the attacking unit as the FromLoc and the position of the attacked object as the ToLoc. And for the heights you kind of just guesstimate.... I know its crude but it's the best I can come up with at the moment. I suggest just alot of testing to see if the guesses are accurate enough.
I also create an effect at udg_bj_LastKeptLoc and damage the unit if the function returns true. I've been experimenting with creating a flying unit as the effect and setting the fly height to udg_bj_LastKeptHeight The only real problem is when the terrain height is a negative number. and then the unit flys at 0 instead of whatever negative number.
Global Variables needed:
udg_bj_LastKeptLoc
udg_bj_LastKeptHeight
Hopefully I didn't mess anything up when I changed a few lines that were different because of my specific game(They were there in bad programming habit anyways).
This will not find if a dodadd or other obstacles are intersecting the line, but I do have a method of achieving this but it is a bit messy and its as efficient as it could be or cleanly versatile yet(Versatile meaning working outside of just my one game), after I clean that code up a bit I might post.
Bullet Immitator-
Since I call it a bullet immitator I might as well explain myself, The basic idea is you have the position of the attacking unit as the FromLoc and the position of the attacked object as the ToLoc. And for the heights you kind of just guesstimate.... I know its crude but it's the best I can come up with at the moment. I suggest just alot of testing to see if the guesses are accurate enough.
I also create an effect at udg_bj_LastKeptLoc and damage the unit if the function returns true. I've been experimenting with creating a flying unit as the effect and setting the fly height to udg_bj_LastKeptHeight The only real problem is when the terrain height is a negative number. and then the unit flys at 0 instead of whatever negative number.
Global Variables needed:
udg_bj_LastKeptLoc
udg_bj_LastKeptHeight