OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: neilreed on 11 Nov 2007, 23:07:26
-
Hello , people , iam having some trouble with a basic camera script , i want to place this camera in front of player 5 meters and 1 meter up but i get a position in the middle of the sea, with the camera bouncing up and down ? iam using desert island please can anyone see what iam doing wrong
sample script ,
_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]
_cam camsettarget player
_cam camsetrelpos [0,0.5,1]
_camera camSetFOV 0.700
_camera camCommit 0
~8
_cam cameraeffect ["terminate", "back"]
camdestroy _cam
titlecut [" ","BLACK IN",2]
exit
-
you have cam set by you need to use @camcommitted _cam to start it, ,, look at the @camcommitted _cam in this code
thats where the cam starts to run..
; for the intro camera scripting tutorial
; create camera
_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]
; point the camera at the player, and place it 2m to the players left,
; 10m to his front and 3m above the ground
_cam camsettarget player
_cam camsetrelpos [-2,10,3]
_cam camcommit 0
; fade in from black over 2 seconds
titlecut [" ","BLACK IN",2]
; wait for 2 seconds for the fade to complete
~2
; move the camera to 5m behind the player, 2m to his left and 0.5m above the ground
; do the move over 10 seconds, and then wait for 2 seconds
_cam camsetrelpos [-2,-5,0.5]
_cam camcommit 10
@camcommitted _cam
~2
; target object2, moving the camera to a relative position that is
; 3m in front, 1m to the left and 2m above the ground. Move over 10 seconds, then wait for 2.
_cam camsettarget object2
_cam camsetrelpos [-1,3,2]
_cam camcommit 10
@camcommitted _cam
~2
; fade out to black over 2 seconds
titlecut [" ","BLACK OUT",2]
; wait for 2 seconds for the fade to complete
~2
; end cutscene
_cam cameraeffect ["terminate", "back"]
camdestroy _cam
; fade back in over 2 seconds
titlecut [" ","BLACK IN",2]
exit
to make it bounce adjust the height by 0.3 maybe even smaller 0.2
then august the _camera camCommit 0 to _camera camCommit 0.2 or more or less and set the
@camcommitted _cam 0.2
~0.2 or to what you have the _camera camCommit 0.2 set to in time, you'll have to play around a bit to get the right bounce you want. hope that helps :)
-
your problem lies here:
_cam camsettarget player
_cam camsetrelpos [0,0.5,1]
_camera camSetFOV 0.700
_camera camCommit 0
~8
the camera has been created using the variable _cam, but you use the variable _camera for the commit part. it should all be the one variable, either _cam or _camera, but not both.
-
thanks guys that helped a lot :good:
i see my mistake now.