| 07-08-2008, 08:09 PM | #1 |
Okay so for a projectile spell im making, I wish to keep the projectile the same flying height no matter what terrain heigh it is, I've tried making this work, but it doesn't work out the way I want it to, here is what I made, in a rough outline since the code is on my other computer. JASS:local real difference local real x local real y local real z set tempLoc = Location(x,y) // It is used in a timer, so x and y values are preset to current location set difference = GetLocationZ(tempLoc) set x = newunit //forgot what i put here, but it doesn't really matter set y = newunit //forgot what i put here, but it doesn't really matter set tempLoc = Location(x,y) set difference = difference - GetLocationZ(tempLoc) set z = z + difference This doesn't work the way I want it to at all, i'll do a bad attempt at an ASCII image. Code:
lets just say that the dot is the projectile :D
........
. .
................... ....................
------------------\ /--------------------
\______/
lets just say that the above is the terrainAs you can see, instead of remaining in the same Z axis position, the thing just goes as high as the lowest point in the bump is, making it look like there is an invisible bubble around the hole that makes the bullet go smoothly about.:( |
| 07-08-2008, 08:46 PM | #2 |
Why don't you just store the absolute height you want the projectile to be at, it would make the claculations a lot more simple, the flying height would simply equal absolute height - locationZ. |
| 07-08-2008, 08:50 PM | #3 |
Or you could use some projectile spell from WE xD |
| 07-08-2008, 09:06 PM | #4 | |
Quote:
This is a 'feature' of the flying movement type. What you need to do is make your dummy unit ground movement type, remove its collision and use the crow form trick to allow you to change its flying height. Then its absolute Z height will always be exactly GetLocationZ(GetUnitLoc(u)) + GetUnitFlyHeight(u), rather than flying units (which, as you noticed, take the maximum terrain Z height from a certain area around them which I haven't bothered to find the exact dimensions of). |
| 07-08-2008, 09:18 PM | #5 |
On second thoughts, you could always order it to move like a flying unit, than it would do all the job for you ! =P Cheap solutions lol |
| 07-08-2008, 09:18 PM | #6 | |
Quote:
Ah, so thats the problem, though flying was same as a ground unit with crow ability, thanks bro, I was thinking my formula was off. edit: just tested it and it works 110%, thanks, +rep |
