Jump to content
Sign in to follow this  
ReaperY2K

Camera scripting

Recommended Posts

Ive worked my way through many tutorials  and read me files about scripting.....and yet am still in a hole!!

what im trying to do via a script is get a camera to position itself on a marker and follow my target, so it pans to follow its movements and then switch to another camera elsewhere following the same target! ive tryed camerasettarget aP1 and camerasetrelpos (Getpos Camera1) - Camera1 being the marker for the camera position (the Getpos command didnt work though, although in many tutorials they use it so am i doin it wrong??)

any help would be greatly appreciated, also is there any camera commands to follow the target or spin around a marker eg. Spin around a base at a height to view it??

1 more thing......ive tried the camera.sqs and executed it on my target but when i preview i get an error and target the ocean instead of the man.....plz help    confused.gif

Share this post


Link to post
Share on other sites

CamSetTarget just points the camera to the target and make it pan so that the target is always inthe center of the screen. The camera won't move. To make the camera follow the target, you'll have to constantly update it's position (with a loop in a script) with camSetRelPos

something like :

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_camera camSetTarget _tgt

_i=0

_max=3000

#Loop

?(_i > _max):goto "ExitLoop"

_camera camSetRelPos [0, -10, 0]

~0.0001

_i=_i + 1

goto "Loop"

#ExitLoop

<span id='postcolor'>

But I'm not sure this is what you want.

If you only want the camera to pan on your target, use (as I did) :

_camera camSetTarget _tgt

_camera being the camera created by camCreate, and _tgt the vehicle you are following.

When you want to change camera, destroy the first one, and create another one at the other position.

BTW, you can't get a marker's position with getPos, use getMarkerPos instead (markers are the only objects requiring special function to retrieve their position)

Whis'

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×