OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: dmakatra on 12 Jan 2004, 22:42:00
-
Hi! I have this question about cameras:
So I have this cutscene right? With the following 2 lines:
_camera camsettarget _pos
_camera camsetpos [_x,_y,10]
Now, this works perfectly, but this is just really a test. You see what I need is to put in the same coordinatesin camsettarget except for the z coordinate, so I'll get a shot from above. So I use these lines:
_camera camsettarget [_x,_y,0]
_camera camsetpos [_x,_y,10]
Now, when I preview it, the camera shows that yellow-orange-green-whatever looking colour you know? What's wrong? I thought I would get a normal shot from above. Now, when you tell me what's wrong I promise you I will bang my head in my desk, I have had praticly none sleep the past few days. Thanks!
:beat: *Gets Shot* :beat:
-
Can you even target coordinates? Doesn't it have to be an object? :-[
That and I nearly always use camsetrelpos because you can easily get the camera to a spot in relation to the target with this command.
_cam camsettarget whateverobjectname
_cam camsetrelpos [0,0,10]
would place the camera directly above the whateverobjectname
-
You can target coordinates, u do that when using the camera.sqs.
:beat: *Gets Shot* :beat:
EDIT: Here for example, just something I picked from a search on the forum:
_cam camSetTarget [9556.62,9659.40,0.00]
_cam camSetPos [9913.54,9534.66,221.65]
-
Riiight.. ;D ::)
Well then, have you double triple checked that _x and _y are defined right?
-
You mean like something:
hint format ["%1, %2", _x, _y]
something like that? Think so, I'll check again.
:beat: *Gets Shot* :beat:
-
I've tried it now(was in school before, hence the delay before this answer)and it's coords allright.
:beat: *Gets Shot* :beat:
-
Greetings.
Hmm...most interesting. Cam scripts are great fun when they don't work. Can you post the whole script up? it might help us to isolate the problem.
-Supr. Cmdr. PsyWarrior
-Psychic Productions
-
/me is shooting blind
Wheoo well well well.. umm.. have you tested the script with a set of "normal" coordinates. I mean instead of
_camera camsettarget _pos
_camera camsetpos [_x,_y,10]
you'd try
_camera camsettarget [3000,3000,0]
_camera camsetpos [3000,3000,10]
Give it a try. Other than that I have nothing more to say ;D :-\
-
I have tried with real coords but I don't want that. I'll put the script up but it's far from finnished yet and I know that some places are wrong and will give error messages, and some commands that looks weird since I ain't done yet, etc, etc.
_pos = _this select 0
SS_WhatEverCrapBool = createdialog "SS_Dialog"
_camera = "camera" camcreate [0,0,0]
_camera cameraeffect ["internal","back"]
_x = _pos select 0
_y = _pos select 1
_y = _y - 1
_z = 100
_camera camsettarget [_x,_y,1]
_camera camsetpos [_x,_y,10]
_camera camcommit 0
;titletext [format ["%1 and %2", _x, _y],"Plain"] <---- there ya have your check Artak :)
#loop
setacctime 1
? (SS_NorthBool) : goto "north"
; blah, blah, add some crap here that aint important for ya to read.
~0.5
goto "loop"
#north
_y=_y+50
_camera camsettarget [_x,_y,0]
_camera camsetpos [_x,_y,10]
_camera camcommit 0
SS_NorthBool=false
:beat *Gets Shot* :beat:
-
what are you inputting in _this select 0 (_pos)?
and did it work with the normal coords
-Psy
-
ya it worked with normal coords.
I execute it via onmapsingleclick
onmapsingleclick {[_pos] exec "SS_Script.sqs"}
-
:hmm:
Okay, try commenting out all the bits not completely necessary for the camera scripting (_y = _y -1 etc), leaving just the cam commands and the _pos select stuff.
I'm reaching here, but you never know.
-Psy
-
Nope, didn't work. It's in situations like this you just wanna kick some1 from BIS' arse. ;) Or my own, whichever's closest. ;D
:beat: *Gets Banned From OFPEC By Violation Of The Gods* :beat:
-
Blasphemy!
Anyway, I'm out of ideas for the minuite. The only thing I can suggest is to execute a different script onMapSingleClick that moves a GameLogic to the specified coords, and then target the GameLogic.
I know that that still doesn't solve the immediate problem, but it might be a workaround for the time being.
If I think of anything else I'll be back. Sorry I couldn't be more help right now.
*PsyWarrior strains brain trying to think. Collapses to floor ("FXStandSurDead") and hits head on filing cabinet.*
-PsyraroWir
-siPcyhc Podrutciosn
-
Try it like this.
_pos = [3000,3000]
;SS_WhatEverCrapBool = createdialog "SS_Dialog"
_camera = "camera" camcreate [0,0,0]
_camera cameraeffect ["internal","back"]
_x = _pos select 0
_y = _pos select 1
_y = _y - 1
_z = 100
_camera camsettarget [_x,_y,1]
_camera camsetpos [_x,_y,10]
_camera camcommit 0
titletext [format ["%1 and %2", _x, _y],"Plain"] <---- there ya have your check Artak :)
~10
#loop
setacctime 1
? (SS_NorthBool) : goto "north"
; blah, blah, add some crap here that aint important for ya to read.
~0.5
goto "loop"
#north
_y=_y+50
_camera camsettarget [_x,_y,0]
_camera camsetpos [_x,_y,10]
_camera camcommit 0
SS_NorthBool=false
-
Uh... What will that help me Artak? Then I will get a fixed pos of 3000 which I don't want.
:beat: *Gets Shot* :beat:
-
HERE IS THE ANSWER:
Simply, you cannot target a camera exactly vertically downwards.
You need it at an angle so the camera knows which way is 'up' and which is 'down' and which direction to face - even though it appears to be vertically downward.
So try this:
_camera camsetpos [_x,_y,10]
_camera camsettarget [_x,(_y+0.01),0]
Effectively you will get the same thing.
-
That's why I used _y=_y-1, but I'll try it again.
:beat: *Gets Shot* :beat:
-
Hmmm, that did it! Thanks m8! Wonder why my _y=_y-1 didn't work ???
:beat: *Gets Locked* :beat: