| 03-27-2005, 10:58 AM | #1 |
I. Hate. Blizzard. I'm still working on a third person camera system. The problem is the height thing. I've tried all sorts of stuff with the new GetTerrainZ () function, but nooooo. Warcraft is a BITCH. I can get the terrain height, and use it to set the camera Z-Offset, but the problem is, the Z offset makes the camera stay a certain distance above the terrain the camera is over. If that was all there was to it, this'd be fine, and I would need hardly any triggers. Unfortunately, the Z-Offset thing doesn't always make the camera stay the appropriate height above the terrain that the camera is over, so when following my unit up hills, it goes all screwy. However, I have seen a function in the GUI that allows you to get the "Source-Z Of Current Camera Object". What I (and everyone else struggling to get a decent third person camera) needs is the ability to set the camera "Source-Z". NOT the height offset. Just the Z of the camera, not the Z distance between camera and ground. In theory, the only trigger needed would be something like: Events: Every 0.05 Seconds Conditions: Actions: Player Group- Pick every player in (ThirdPersonViewPlayers) and do Camera- Set (Source Z) to (Z of (Position Of (PlayerHero[(Player Number Of Picked Player)]+140 Unfortunately I can't find a way to set "Source Z". Does anyone know one? Or, failing that, has anyone found a different way of making a third person camera that follows you hero up and down hills properly? |
| 03-27-2005, 11:18 AM | #2 |
Well you will need JASS: Code:
PanCameraToTimedLocWithZForPlayer takes player whichPlayer, location loc, real zOffset, real duration returns nothing So use that with the other JASS function to get the Z of a unit (point really) Code:
GetLocationZ(GetUnitLoc(GetTriggerUnit())) I hope that helps. If it doesnt then just post. |
| 03-27-2005, 11:39 AM | #3 |
As far as I can tell, what you're referring to is the "Pan Camera With Interpolated Height" function in the GUI... If it is, then I've tried it, and it still doesn't work... Can you give me an entire trigger based on that please, so I can see if it is what I think, and test it...? |
| 03-27-2005, 08:34 PM | #4 |
I've made a lil test map for all people who have trouble with third person cam: http://195.241.126.94/index.php?page=maps.php?id=37 it only has one flaw. The camera can go into the terrain. But thats not to hard 2 fix, just take the height of the terrain under the camera and then calculate the angle it should have with Atan2. |
| 03-28-2005, 07:32 AM | #5 |
toots, did you even READ my last posts? That's the only problem I'm still having dammit! I can do everything else,even made it rotate with the arrow keys, it's the height that's the problem here! |
| 03-28-2005, 11:09 AM | #6 |
nono, sry thats not what I ment. Just download the map and u'll see. It goes with the terrain, just if the terrain is to steep itll go in it. Owell, ill make it more complex so all will be happy with it. Give me a few secs EDIT: ok, its there, download the updated version, cam will never touch the terrain http://195.241.126.94/index.php?page=maps.php?id=37 |
| 03-28-2005, 11:33 AM | #7 |
Just gotta test it, but if it works, I'll give you as much rep as I can... |
| 03-28-2005, 11:34 AM | #8 |
well its not as nice as it can be, u might want 2 change distance abit and some more things, but this is the basic start ^_^ |
| 03-28-2005, 12:51 PM | #9 |
Just managed to test it in your map, and put it into mine. In your map, it's great (although it goes a bit funky when you go too near the edges, but in mine the camera jerks like it's in the middle of an earthquake, and when I'm at the very top of my map, the camera is way above my units head! I'll paste the way it's put in my map now, so you can see what I've changed... It's really annoying! On the plus side, however, it doesn't go through the scenery any more... Periodic Events Time - Every 0.10 seconds of game time Conditions Actions -------- You can replace the mountain king with a hero variable array and use playernumber of picked player as index. -------- -------- You can also remove the if/then/else to make the cam go with the terrain when u go up mountain aswell, but I found it harder to walk like that. -------- Player Group - Pick every player in ThirdPersonViewPlayers and do (Actions) Loop - Actions Set tempPoint = (Position of PlayerHero[(Player number of (Picked player))]) Set tempPoint2 = (tempPoint offset by 300.00 towards ((Facing of PlayerHero[(Player number of (Picked player))]) + 180.00) degrees) Custom script: set udg_tempReal = GetLocationZ(udg_tempPoint) Custom script: set udg_tempReal2 = GetLocationZ(udg_tempPoint2) Camera - Set (Picked player)'s camera Distance to target to 300.00 over 0.20 seconds If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions tempReal2 Greater than or equal to tempReal Then - Actions Camera - Set (Picked player)'s camera Angle of attack to ((Atan2((tempReal - tempReal2), 300.00)) - 10.00) over 0.20 seconds Else - Actions Camera - Set (Picked player)'s camera Angle of attack to 350.00 over 0.20 seconds Camera - Pan camera for (Picked player) to tempPoint over 0.20 seconds Camera - Set (Picked player)'s camera Height Offset to (0.50 x tempReal) over 0.20 seconds Custom script: call RemoveLocation(udg_tempPoint) Custom script: call RemoveLocation(udg_tempPoint2) See? I didn't think I changed THAT much... And would this work in multi player without changing tempPoint, tempPoint2, tempReal and tempReal2 to arrays? If you'd need to change them to arrays I'm stuffed, 'cause I know next to nothing about JASS, and I wouldn't be able to change those custom script lines... |
| 03-28-2005, 01:42 PM | #10 |
if it goes over the units head, then just change the height a little: instead of tempReal x 0.5 try tempReal x 0.4 or something, just change it a little. For the earthquake.... thats a little hard, cause the terrain under at the earthquake changes height, the camera will follow... so whats best 2do is disable height increasing/decreasing when a unit is in range of the earthquake. |
| 03-28-2005, 03:27 PM | #11 |
LOL! No, there is no earthquake. That was a similie. The terrain is perfectly smooth, and it happens no matter where I go... |
| 03-28-2005, 03:39 PM | #12 |
oh sry, read that part wrong ^^ anyway, I dont know why that would happen and I dont know what exactly u are talking about (camera going crazy has degrees ... ;)) im sure u can work it out yourself... else u could try leaving out the Atan part and always set the angle to 350 but then it might go into the terrain on steep hills. |
| 03-28-2005, 03:46 PM | #13 |
Mm mm. Thanks. |
