Blizzard's WorldHeight() function is broken, and I kind of need it to make it so bullets fly straight. Here is an illustration of what happens with the broken WorldHeight():
Notice the squiggly path on the second series of shots that go over varied terrain. Does anyone know of a way to stop this, or will I just have to wait for Blizzard to fix their broken shit?
NOTE: By "WorldHeight() is broken", I mean that it returns the height of the terrain relative to the height of the terrain, i.e. 0, no matter what, so I can't find a way to get the absolute height of anything.
Post has been edited 3 time(s), last time on Jun 1 2010, 3:18 am by FatalException.
The multiplication by 0.5 at the start is because that math is in meters, and I figure one gridsquare is approximately 2 meters across (since a marine is 1 gridsquare tall).
I also tried adding and subtracting (8 - lv_grenadeWorldHeight) (not at the same time), but that worked the same, since WorldHeight() returns nothing but zeroes.
Okay, that didn't really help me (too complex for me to try to understand it, I'm very tired), so I'll tell you what I think the problem is:
From what I've done with physics (in the GUI editor), I've found that there are two functions that determine height. One is "Height at point", which determines the height of the terrain at that point, and one is "Height of unit", which is the height of the unit above the terrain. Thus, to properly model a projectile's flight, you'd need to work with the sum of these two functions to do the calculations, then subtract the height at point to determine the needed height of unit at the next location.
I don't know which of these two it is in Galaxy, (I can figure it out, but my head isn't up to complex thoughts right now), but it sounds like you're using one of these two instead of their sum while doing the calculations. It would cause the same problem you have.
It might be that I'm completely wrong and you have another problem entirely, but I'm too tired to look through your code and the symptoms fit.
I replaced the WorldHeight() functions with PointGetHeight(), but it didn't like that, since I guess point variables aren't allowed to be 3D. I tried creating a 3D point, but it doesn't want me to move it. When I try to move it using
I get an error that says that I can't assign from the left side. Why can't preplaced points be moved?
Also, the function that I pasted up above that you said was too complicated is just position with respect to starting position, velocity, angle, acceleration, and time. y = y0 + v sin(Θ)t + 0.5at^2
Yeah, I saw that. But I didn't want to get into it with the variables and all. The point isn't to PointGetHeight(), but to get the height of the TERRAIN at a 2D-point, and to get the height of a unit above the terrain. They're both GUI functions that, combined, determine total height which is what you can reliably do physics with. However, I don't know the galaxy equivalents.
So, I've tried a multitude of things, but nothing works. There's absolutely no way to find the absolute height of anything, since everything returns height relative to the ground wherever it is, and the GetDistanceBetweenPoints() only works in two dimensions so I can't use that. I think I'm just going to have to wait until SC2 comes out for this crap to start working.
Not sure what you are talking about here, using WorldHeight to get the height of a point works. When I place a point on the ground and use WorldHeight() to get the point it returns 8. (Note: tested with 2d point) What parameters are you passing it?
As I told you, you can do it in GUI. The "Unit height" (or similar) function determines height of unit relative to the terrain level, and "Height of point" (or similar) determines height of terrain relative to 0. Just redo everything in GUI and use these two functions to work with height.
Suddenly, the WorldHeight() function appears to be working, but stuff isn't behaving as I want it to. The grenade no longer shows up, and shooting when the pitch is between 350 and 360 often causes the explosion to occur where the player is standing. Also, I think it's still changing the height relative to the terrain. Map is attached. The most important bit of math is as follows, in case people don't feel like going through the whole map: