Home   Help Search Login Register  

Author Topic: tracker for shaking  (Read 4081 times)

0 Members and 1 Guest are viewing this topic.

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
tracker for shaking
« on: 10 Jun 2007, 13:06:45 »
basically i need a way of tracking an object, then from another script, shake the camera from where ever the camera currently is.  i have my own shaker, i just need an effective tracker for the job. thank you
Campaigns are hard, I'll stick with scripting for now!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: tracker for shaking
« Reply #1 on: 10 Jun 2007, 13:25:48 »
Easiest way would be to pass the object as argument of your shaking script, am I missing something here? What do you mean by "tracking"?

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: tracker for shaking
« Reply #2 on: 10 Jun 2007, 13:30:49 »
supose you are running a cutscene, but your unsure about when sumthing in gonna explode.  so you write the cutscene and you create an additional script to shake the camera of the cutscene.

to do this, the additional script would need to 'track' the current location of the camera, then shake the camera
Campaigns are hard, I'll stick with scripting for now!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: tracker for shaking
« Reply #3 on: 10 Jun 2007, 13:33:27 »
You may just use a gobal variable set to any value which triggers the shaking effect. Triggers or a different script may take care of that global variable.

Dont you already have this topic open in the beta board?

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: tracker for shaking
« Reply #4 on: 10 Jun 2007, 13:39:11 »
i do, but it's a basic version, i need a more flexible script.  do you know how to make this shake work as i want?
Campaigns are hard, I'll stick with scripting for now!

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: tracker for shaking
« Reply #5 on: 10 Jun 2007, 13:45:00 »
bingo.. i need to make the camera name a global variable so i can refer to and get the position of from another script.  but i have never used globals before.. can you tell me how? and if posible, can you tell me how to get the position (and follow) of the camera in use. thank you
Campaigns are hard, I'll stick with scripting for now!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: tracker for shaking
« Reply #6 on: 10 Jun 2007, 13:48:04 »
A global varialbe is anything that does not start with _
_varname1 is local
varname2 is global

your shaking camera is attached to an object, so you only need to track the position of that object with a simple getpos command.

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: tracker for shaking
« Reply #7 on: 10 Jun 2007, 13:55:34 »
thank you, i will try this.  however, i know the getpos will get you to the object, but can you give me an example of the layout please?

because i have seen things like this:

; use: [cameraname, shakiness] exec "shakecan.sqs"

_cam = _this select 0
_shakiness = _this select 1

_ox = getPos _cam select 0
_oy = getPos _cam select 1
_oz = getPos _cam select 2

endshake = 0

#shake
_rx = (random(_shakiness)) - (_shakiness / 2)
_ry = (random(_shakiness)) - (_shakiness / 2)
_rz = (random(_shakiness)) - (_shakiness / 2)
_cam camSetPos [_rx + _ox, _ry+_oy, _rz+_oz];
_cam camCommit 0
~0.05
_cam camSetPos [_ox, _oy, _oz];
_cam camCommit 0
~0.05
? (endshake==0) : goto "shake"

exit


i can hardly understand this. and where it says; use: [cameraname, shakiness] exec "shakecan.sqs"

i just cant figure it out.  the alternative was this, which i found more usefukl, but i still couldnt understand it:

;initiate with [name,x,y,z] exec "shakey_camera.sqs"
_unit = _this select 0
_x = _this select 1
_y = _this select 2
_z = _this select 3
stoptracking = false

_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]
_cam camSetTarget _unit
_cam CamSetFOV 0.7
   
#loop
~0.05
_cam camSetRelPos [_x + random 0.3,_y + random 0.3,_z + random 0.3]
_cam camCommit 0
? not stoptracking : goto "loop"
_cam cameraeffect ["terminate", "back"]
camdestroy _cam
exit

and againm, i havent a clue what; [name,x,y,z] exec "shakey_camera.sqs"

i know what the execute is, its normally [] exec "xxxxx.sqs"   i use it all the time, but its the value name,x,y,z that i dont get


can you explain it at all?

thank you
Campaigns are hard, I'll stick with scripting for now!

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: tracker for shaking
« Reply #8 on: 10 Jun 2007, 14:02:08 »
further, if this is as simple is finding the object, then it wont continue the previous camera script.  or would the shake take effect during the previous and then continue with the previous after rtghe shake script is finished?
Campaigns are hard, I'll stick with scripting for now!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: tracker for shaking
« Reply #9 on: 10 Jun 2007, 15:29:28 »
Sorry, but now I really have no idea at all what you are really trying to do in your cutscenes.

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: tracker for shaking
« Reply #10 on: 10 Jun 2007, 15:32:12 »
ok, all im trying to do, is have a cutscene run normally.  then when a particular explosion goes off. the screen shakes. and the magic thing about what im trying to do, is that the explosion could go off at any time, meaning the shake must be able to appear at any time during the cutscene. thats what im trying to do. can you help me?
Campaigns are hard, I'll stick with scripting for now!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: tracker for shaking
« Reply #11 on: 10 Jun 2007, 16:02:31 »
So, you have the camera moving following your cutscene storyline, and when something explodes the camera should shake, right?
Now forget about the shake, how are you moving the camera through the cutscene?

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: tracker for shaking
« Reply #12 on: 10 Jun 2007, 16:31:28 »
heres a basic example, im using it for testing, moving from object to object:

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

cam camsettarget ob1
cam camsetrelpos [-5,10,3]
cam camcommit 0

~5

cam camsettarget ob2
cam camsetrelpos [-5,10,3]
cam camcommit 2

~5

cam camsettarget ob3
cam camsetrelpos [5,-10,3]
cam camcommit 2

~5

cam camsettarget ob1
cam camsetrelpos [5,10,3]
cam camcommit 2

~5

cam camsettarget ob2
cam camsetrelpos [-5,10,3]
cam camcommit 0
Campaigns are hard, I'll stick with scripting for now!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: tracker for shaking
« Reply #13 on: 10 Jun 2007, 16:41:45 »
Check the explosion condition during the delays (~5) and apply setRelPos changes with quick commit, after that, resume the path of the camera (same rel pos as before exposion and commit it in the original time minum the time consumend during your checks minus the time consumed by the shaking effect.

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: tracker for shaking
« Reply #14 on: 10 Jun 2007, 16:45:59 »
so i'd need to resume the previous camera?
Campaigns are hard, I'll stick with scripting for now!