Staredit Network > Forums > SC2 Assistance > Topic: World height
World height
Jun 1 2010, 1:14 am
By: FatalException  

Jun 1 2010, 1:14 am FatalException Post #1



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.



None.

Jun 1 2010, 1:25 am Centreri Post #2

Relatively ancient and inactive

What equation are you using to specify the height of the missile?



None.

Jun 1 2010, 1:32 am FatalException Post #3



lv_grenadeHeight = 0.5 * (1.5 + (gv_grenadeVelocity * -Sin(gv_grenadePitch) * TimerGetElapsed(gv_grenadeTimer)) + (-4.9 * Pow((TimerGetElapsed(gv_grenadeTimer)), 2))) - lv_grenadeWorldHeight;

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.



None.

Jun 1 2010, 1:39 am Centreri Post #4

Relatively ancient and inactive

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.



None.

Jun 1 2010, 2:59 am FatalException Post #5



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
Code
PointFromId(137) = PointWithOffsetPolar(gv_grenadeInitPos, lv_grenadeHorDist, gv_grenadeYaw);

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



None.

Jun 1 2010, 3:09 am Centreri Post #6

Relatively ancient and inactive

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.



None.

Jun 1 2010, 4:31 am FatalException Post #7



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.



None.

Jun 1 2010, 5:04 am Temp Post #8



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?



None.

Jun 1 2010, 5:18 am FatalException Post #9



(c_heightWorldGround, lv_grenadePoint)

I tried it with 0-2 in the first argument slot, too, and all I got was zeroes.

Also, it appears that someone on Mapster has figured out how to make a height map.



None.

Jun 1 2010, 5:24 am Centreri Post #10

Relatively ancient and inactive

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.



None.

Jun 1 2010, 5:50 am Temp Post #11



Quote from FatalException
(c_heightWorldGround, lv_grenadePoint)

I tried it with 0-2 in the first argument slot, too, and all I got was zeroes.

Also, it appears that someone on Mapster has figured out how to make a height map.

Are you sure your point is right then?



None.

Jun 1 2010, 6:19 am FatalException Post #12



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:
Code
lv_grenadeHeight = (0.5 * (2 + (gv_grenadeVelocity * -Sin(gv_grenadePitch) * TimerGetElapsed(gv_grenadeTimer)) + (-4.9 * Pow((TimerGetElapsed(gv_grenadeTimer)), 2))) + gv_grenadeInitHeight) - (lv_grenadeWorldHeight - 8)


(How to test: Select the ghost to turn on mouselook. Press 2 to select the grenade launcher. Left-click to fire.)

Attachments:
test 2a.SC2Map
Hits: 1 Size: 284.64kb



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
[2024-4-26. : 6:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[2024-4-26. : 6:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[2024-4-26. : 6:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[2024-4-26. : 6:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[2024-4-26. : 6:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
Please log in to shout.


Members Online: jjf28