Home   Help Search Login Register  

Author Topic: Chase cam  (Read 635 times)

0 Members and 1 Guest are viewing this topic.

spiralsoap

  • Guest
Chase cam
« on: 08 Jan 2004, 06:44:17 »
I know this is simple but i cant seem to figure it out.. i would like a camera to follow my jeep, however, i dont want to use terminate cam i want a cinematic camera i can have at any x,y,z point watching and following the jeep..

what cam command is this?

Offline rhysduk

  • Former Staff
  • ****
Re:Chase cam
« Reply #1 on: 08 Jan 2004, 18:37:52 »
Not quite sure what u mean by a cinematic camera. oh, do you mean a Cutscene or an Intro  ??

cameraname camCreate [x,y,z] should do the trick..

have you read the Cutscene tut by SnYpir ??

Rhys
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

spiralsoap

  • Guest
Re:Chase cam
« Reply #2 on: 08 Jan 2004, 19:15:17 »
this is for an intro yes.. i have read snyp's tut too.. let me explain better cuz i still cant find this in any tutorial.

what i have is a jeep driving down the road.. and i want to set a camsetrelpos where the camera is above the jeep and to the right.. but i dont want the jeep to just drive by the camera.. i want the camera to stay focused on the jeep as it drives.. kind of like what terminate looks like.. but i dont want to use terminate because the player can move the camera around.

Offline rhysduk

  • Former Staff
  • ****
Re:Chase cam
« Reply #3 on: 08 Jan 2004, 20:57:43 »
HI,

this is what you need, its a vehcile camera script made by SnYpir, concept by Turok_GMT...

I think you need to use camDestroy ... the player shouldnt be able to move the camera around ...  :P
Code: [Select]
; get camera vehicle and target
_unit = _this select 0
_target = _this select 1

; u can change the positional offsets for the camera (these are relative to the vehicle)
; x offset
_camoffsetX = (_this select 2) select 0

; y offset
_camoffsetY = (_this select 2) select 1

; z offset
_camoffsetZ = (_this select 2) select 2

; do u want your offsets to be relative to the vehicle?
_camrelative = _this select 3

; clear the variable that will stop this script
vehiclecamstop = false

; create a camera
_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]








; now create a loop to continuously update the cam's pos
; so it appears to be attached to the vehicle

#loop

_newpos = getpos _unit

; set posn not relative to vehicle?
? NOT(_camrelative) : _cam camsetpos [(_newpos select 0) + _camoffsetX, (_newpos select 1) + _camoffsetY, (_newpos select 2) + _camoffsetZ]; goto "commit"

; set posn relative to vehicle
_cam camsettarget _unit
_cam camsetrelpos [_camoffsetX,_camoffsetY,_camoffsetZ]

#commit
_cam camcommit 0

; aim camera at target
_cam camsettarget _target
_cam camcommit 0


; insert a small update time to avoid anychance of any nasty
; infinity loop errors

~0.01

; perform an if test to see if _stop has been set to true
; of not, do another lap of the loop

? NOT(vehiclecamstop) : goto "loop"

; the loop ends here when vehiclecamstop gets set to true by either
; a trigger or a waypoint's "on activation" field

; once loop had ended, kill the camera and return control to
; player

_cam cameraeffect ["terminate", "back"]
camdestroy _cam

exit

Just for your reference :-

This is pulled from the beggining of the script, IE no effect on the script... documentation if you were :)
Code: [Select]
;Script for a Vehicle Camera
;Mission1Sofar
;concept by Turok_GMT, modified by snYpir,

;syntax:
;[<name of vehicle>, <name of unit to target>,
;<[xoffset,yoffset,zoffset]><relative to vehicle?>] exec "vehiclecam.sqs"

;example:
;[heli, dilbert,[0,0,-10],false] exec "vehiclecam.sqs"

Regards Rhys
______________________________________

EDIT :- took out a bit of old information... (MY OLD OFP MOD Studio Info)
« Last Edit: 08 Jan 2004, 20:59:46 by rhysduk »
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline Blanco

  • Former Staff
  • ****
Re:Chase cam
« Reply #4 on: 08 Jan 2004, 21:17:38 »
This camscript should be more a swingcam like you see in racegames.

[<name of the vehicle>,<time the cam should run>] exec "swingcam.sqs"

example [car, 40] exec "swingcam.sqs"

Code: [Select]
;;swingcam.sqs

_unit = _this select 0
_exitcam = _this select 1

_camera = "camera" camcreate [0,0,0]
_camera cameraeffect ["internal","back"]

_camera camsettarget _unit
_camera camsetrelpos [0,-1,1.2]
_camera camcommit 0
@camcommited _camera


_i = 0

#loop
_i = _i + 1
_camera camsettarget _unit
_camera camsetrelpos [0,-1,1.2]
_camera camcommit 1
~1
?_i < _exitcam : goto "loop"

~2

_camera cameraeffect ["terminate","back"]
Camdestroy _camera


Not tested.



« Last Edit: 08 Jan 2004, 21:18:51 by Blanco »
Search or search or search before you ask.

spiralsoap

  • Guest
Re:Chase cam
« Reply #5 on: 08 Jan 2004, 22:00:28 »
Ok i will give those ideas a shot...

but i really am not familiar with the #Loop command and i used to script a long time ago...

is this the only way to create a "follow" camera?

Offline .pablo.

  • Former Staff
  • ****
  • When in doubt, empty the magazine.
Re:Chase cam
« Reply #6 on: 08 Jan 2004, 23:40:10 »
yes