HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How do I make a camera follow a unit?

03-16-2005, 04:03 AM#1
dpcb
Code:
function Trig_Melee_Initialization_Copy_Actions takes nothing returns nothing
    call MeleeStartingVisibility(  )
    call SetUserControlForceOff( GetPlayersAll() )
    call ShowInterfaceForceOff( GetPlayersAll(), 5.00 )
    call CinematicModeBJ( true, GetPlayersAll() )
    call SelectUnitForPlayerSingle( gg_unit_h000_0001, Player(0) )
    call CameraSetupApplyForPlayer( true, GetCurrentCameraSetup(), Player(0), 0 )
    call PanCameraToTimedLocWithZForPlayer( Player(0), GetUnitLoc(gg_unit_h000_0001), 10.00, 0 )
    call PolledWait( 15.00 )
    call IssueTargetOrderBJ( gg_unit_h000_0001, "smart", gg_unit_n000_0002 )
    call PanCameraToTimedLocWithZForPlayer( Player(0), GetUnitLoc(gg_unit_h000_0001), 10.00, 0 )
    call PolledWait( 15.00 )
    call PauseUnitBJ( true, gg_unit_h000_0001 )
    call CustomVictoryBJ( Player(0), false, false )
endfunction

or:
Code:
Events: Map initialization
Conditions: None
Actions: 
Melee Game: use melee time of day (for all players)
Cinematic: Disable user control (for all players)
Cinematic: Turn on letterbox mode (hide interface) for (All players) fade out over 5.00 seconds
Cinematic: Turn Cinematic mode On for (All players)
Selection: Select Flexwing 0001 <gen> for Player 1 (Red)
Camera: Apply (Current camera) for Player 1 (Red) over 0.00 seconds
Camera: Pan camera for Player 1 (Red) to (position of Flexwing 0001 <gen>) with Height 10.00 above terrain over 0.00 seconds
Wait: 15 game time seconds
Unit: order Flexwing 0001 <gen> to Right-Click Stargate 0002 <gen>
Camera: Pan camera for Player 1 (Red) to (position of Flexwing 0001 <gen>) with 
Wait: 15 game time seconds
Unit: pause Flexwing 0001 <gen>
Game: Victory Player 1 (Red) (Skip dialog, Skip scores)


Now, the question is...
..how come it does not follow my unit "Flexwing 0001 <gen>"?
what must I add, change, remove, etc. to make it work?

any help is greatly appreciated. :)
03-16-2005, 08:41 AM#2
Hyarion
I don't know anything about JASS but couldn't you just use the "Camera- Lock camera to unit" function?
03-16-2005, 08:49 AM#3
divine_peon
use this trigger.

Code:
Event - 
Every .02 seconds of game time

Action - 
Camera - Lock to target unit

btw, that jass sucks.
03-16-2005, 02:12 PM#4
Guest
Divine peon gives a tenth of what is needed...
As I don't have much time now (sorry) I can tell you that you need every x seconds (0.1 is good but may lag) to not only lock camera to unit, but also set camera height = height of terrain at (position of unit) <= YES THIS IS A NEW TRIGGER USE OF 1.18 || and also set all other camera fields to the unit's fields
03-16-2005, 08:23 PM#5
dpcb
Thank you for all your help, thanks to you guys and gals it works, thank you loads. :D