| 05-12-2010, 02:09 AM | #1 |
-Sometimes my camera just automatically pan to a black area on the map and i lost track of my Hero. How nasty it is, do you have any clue about the cause ? |
| 05-12-2010, 05:33 AM | #2 |
code? |
| 05-12-2010, 01:01 PM | #3 |
For panning camera, i always use this: JASS:local unit u = GetTriggerUnit() local player p = GetOwningPlayer(u) call SetUnitPosition(u, GetRectCenterX(gg_rct_JinPort), GetRectCenterY(gg_rct_JinPort)) if (GetLocalPlayer() == p) then call PanCameraToTimed(GetRectCenterX(gg_rct_JinPort),GetRectCenterY(gg_rct_JinPort), 0.) endif |
| 05-12-2010, 04:26 PM | #4 | |
Quote:
if you want to pan a camera to an position, use JASS:globals unit array dummies boolean array panned endglobals function PanCam takes real x, real y, player p returns nothing local integer id=GetPlayerId(p) if panned[id] then call SetUnitX(dummies[id],x) call SetUnitY(dummies[id],y) else if dummies[id]==null then //create new set dummies[id]=CreateUnit(Player(15),'hpea',x,y,0.0) call PauseUnit(dummies[id],true) call ShowUnit(dummies[id],false) call UnitAddAbility(dummies[id],'Aloc') else //move old call SetUnitX(dummies[id],x) call SetUnitY(dummies[id],y) endif set panned[id]=true if GetLocalPlayer()==p then call SetCameraTargetController(dummies[id],0.0,0.0,true) endif endif endfunction function UnpanCam takes player p returns nothing if GetLocalPlayer()==p then call SetCameraTargetController(null,0.0,0.0,true) set panned[id]=false endif endfunction |
| 05-14-2010, 01:44 AM | #5 | |
Quote:
There was a small mistake in code. JASS:function UnpanCam takes player p returns nothing local integer id=GetPlayerId(p) if GetLocalPlayer()==p then call SetCameraTargetController(null,0.0,0.0,true) set panned[id]=false endif endfunction |
| 05-14-2010, 08:10 AM | #6 | |
Quote:
yup, should be JASS:function UnpanCam takes player p returns nothing if GetLocalPlayer()==p then call SetCameraTargetController(null,0.0,0.0,true) endif set panned[GetPlayerId(p)]=false endfunction |
| 05-15-2010, 09:39 AM | #7 |
OOps, thanks for your help ^^ But what's wrong with my code? because it works normally ingame. I don't know if it causes that naughty bug. |
| 05-15-2010, 01:18 PM | #8 | |
Quote:
maybe something with camera-distance or clipping |
