Page 1 of 1

Those working camreas. . .

Posted: Sat Apr 29, 2006 3:33 pm
by Ophisâ„¢
You know these little two cctv beautys... (here)

is there away of making them moving cams? like a cctv cam would do in real life... lets say they swing (rotate) left and wait 10secs, then swing right and wait 10secs, etc etc. And also, would it be a script for them to get them to do it? Im no good with scripts so i wouldn't know how to do it.

btw, i dont need them as of yet, but i would like to use them so i wouldn't mind knowing if this is possable.

Posted: Mon May 01, 2006 2:08 pm
by HDL_CinC_Dragon
Select the brushes that make up the camera NOT INCLUDING the thing that actually sees everything and add an origin right through the middle of the camera brushes from the top view and give it texture origin. With all the camera brushes selected including the new origin you just made, right click in a 2D window and go to Script > Object. Now press N and give it a TargetName of secCam1. Now only select the scripted brush that is the actual eye of the camera and set its TargetName as secCam1Eye.

in your script, have secCam1Eye bind to secCam1. Then you can just have this as your script to have the camera move back and forth:

Code: Select all

Main:
      level waittill prespawn

thread secCam1Controller
   $secCam1Eye bind secCam1
   $secCam1 speed 20 // this sets the speed that the camera will rotate - higher = slower, lower = faster... i think

      level waittill spawn

end

secCam1Controller:
while(1)
{
   $secCam1 rotateY 90 // rotates the camera 90 degrees
   $secCam1 waitmove // waits until the camera has stopped turning
   wait 2 // waits 2 seconds after the camera has stopped turning
   $secCam1 rotateY -90 // rotates the camera back the other way
   $secCam1 waitmove // waits until the camera has stopped turning
   wait 2 // waits 2 seconds after the camera has stopped turning
   waitframe
}
end
I think that should do it but im not 100% sure... Maybe you can try it out as you wait for a smart person to say im wrong haha. Hope this helped!

Posted: Mon May 01, 2006 2:19 pm
by PKM
if it works, would love to see a good screen shot as an example.

Posted: Mon May 01, 2006 4:06 pm
by bdbodger
I think rotatey will just keep rotateing I think you need to use rotatyup or rotateyupto . rotateyup will rotate by the number of degrees you set and rotateyupto rotates to an absolute angle for example rotateyup 10 would rotate an object from a starting point of 80 degrees to 90 degrees but rotateyupto 10 would rotate it from 80 around to 10 degrees . Also you can use rotateydown and rotateydownto .

Posted: Mon May 01, 2006 4:32 pm
by Ophisâ„¢
thank you.. i'll be trying that out tonite. I'll post here soon as it works. If it does then i'll record a little clip of it working.

Posted: Mon May 01, 2006 9:42 pm
by HDL_CinC_Dragon
oh your right Bodger, rotateY 90 will just keep it rotating... ummm give me a minute to re-write and test my code...

Assuming your going to be working with test_camera.map and test_camera.scr:
ok what you have to do is have $Cam_target_1 move around and have the camera object watch... that way, when the user goes to use the camera, his view will follow the target. im too tired to actually write a code for you. sorry.

Posted: Wed May 03, 2006 4:56 pm
by Ophisâ„¢
ok so i got this for my script so far...

Code: Select all

main:

      level waittill prespawn

thread secCam1Controller
   $secCam1Eye bind secCam1
   $secCam1 speed 5 // this sets the speed that the camera will rotate - higher = slower, lower = faster... i think

      level waittill spawn

end

secCam1Controller:
while(1)
{
   $secCam1 rotateyupto 20 // rotates the camera 90 degrees
   $secCam1 waitmove // waits until the camera has stopped turning
   wait 2 // waits 2 seconds after the camera has stopped turning
   $secCam1 rotateydownto -20 // rotates the camera back the other way
   $secCam1 waitmove // waits until the camera has stopped turning
   wait 2 // waits 2 seconds after the camera has stopped turning
   waitframe
}
end


activate_cam_1: 
$cam_switch_1 nottriggerable 
local.camname = "cam_1" 
local.camera = $(local.camname) 
if (level.cam1_removed)
	{local.camera = spawn Camera targetname local.camname origin level.cam1_origin}
else
	{level.cam1_origin=$cam_1.origin}
local.camera_trigger = spawn triggercamerause "targetname" "cam_trigger_1" target local.camera 
local.camera_trigger.origin = ( 0 0 0 ) 
local.camera_trigger setsize ( -30 -30 -30 ) ( 30 30 30 ) 
local.camera_trigger nottriggerable 
local.player = parm.other 
local.camera_trigger doUse local.player 
local.player physics_off 
local.player stufftext "ui_hud 0"
local.camera lookat $cam_target_1
wait .5 
while (local.player.useheld != 1) 
	{waitframe}
local.player stufftext "ui_hud 1"
local.player physics_on
$cam_1 delete
level.cam1_removed=1
local.camera_trigger delete 
$cam_switch_1 triggerable 
end 



activate_cam_2: 
$cam_switch_2 nottriggerable 
local.camname = "cam_2" 
local.camera = $(local.camname) 
if (level.cam2_removed)
	{local.camera = spawn Camera targetname local.camname origin level.cam2_origin}
else
	{level.cam2_origin=$cam_2.origin}
local.camera_trigger = spawn triggercamerause "targetname" "cam_trigger_2" target local.camera 
local.camera_trigger.origin = ( 0 0 0 ) 
local.camera_trigger setsize ( -30 -30 -30 ) ( 30 30 30 ) 
local.camera_trigger nottriggerable 
local.player = parm.other 
local.camera_trigger doUse local.player 
local.player physics_off
local.player stufftext "ui_hud 0"
local.camera lookat $cam_target_2
local.camera watch "$cam_target_2"
wait .5 
while (local.player.useheld != 1) 
	{waitframe} 
local.player physics_on
local.player stufftext "ui_hud 1"
$cam_2 delete
level.cam2_removed=1
local.camera_trigger delete 
$cam_switch_2 triggerable 
end 
Now the $secCam1 speed 5 bit, that doesnt not effect the speed at all.. i have tried the following values for it, 1, 5, 10, -5 and -10. The camrea just "snaps" to the other side rather then move slowly no matter what the value is, its always the same speed.

Also, this directed at "HDL_CinC_Dragon",

"ok what you have to do is have $Cam_target_1 move around and have the camera object watch"

I have no idea how to make it more like that.

Posted: Wed May 03, 2006 6:56 pm
by HDL_CinC_Dragon
first thing, instead of "speed" use "time" in which time is the amount of seconds it will take to rotate that distance

you have this already:

Code: Select all

local.camera lookat $cam_target_1
add this just below that:

Code: Select all

local.camera watch "$cam_target_1"

now that you have it watching it, tell $cam_target_1 to move:

Code: Select all

main:

      level waittill prespawn

thread secCam1Controller
   $secCam1Eye bind secCam1
   $secCam1 time 3 //this is how long it will take to rotate the degree you have set

thread secCam1TargetMover
   $cam_target_1 time 3

      level waittill spawn

end

secCam1Controller:
while(1)
{
   $secCam1 rotateyupto 20 // rotates the camera to 20 degrees
   $secCam1 waitmove // waits until the camera has stopped turning
   wait 2 // waits 2 seconds after the camera has stopped turning
   $secCam1 rotateydownto -20 // rotates the camera back the other way
   $secCam1 waitmove // waits until the camera has stopped turning
   wait 2 // waits 2 seconds after the camera has stopped turning
   waitframe
}
end


activate_cam_1:
$cam_switch_1 nottriggerable
local.camname = "cam_1"
local.camera = $(local.camname)
if (level.cam1_removed)
   {local.camera = spawn Camera targetname local.camname origin level.cam1_origin}
else
   {level.cam1_origin=$cam_1.origin}
local.camera_trigger = spawn triggercamerause "targetname" "cam_trigger_1" target local.camera
local.camera_trigger.origin = ( 0 0 0 )
local.camera_trigger setsize ( -30 -30 -30 ) ( 30 30 30 )
local.camera_trigger nottriggerable
local.player = parm.other
local.camera_trigger doUse local.player
local.player physics_off
local.player stufftext "ui_hud 0"
local.camera lookat $cam_target_1
local.camera watch "$cam_target_1"
wait .5
while (local.player.useheld != 1)
   {waitframe}
local.player stufftext "ui_hud 1"
local.player physics_on
$cam_1 delete
level.cam1_removed=1
local.camera_trigger delete
$cam_switch_1 triggerable
end



activate_cam_2:
$cam_switch_2 nottriggerable
local.camname = "cam_2"
local.camera = $(local.camname)
if (level.cam2_removed)
   {local.camera = spawn Camera targetname local.camname origin level.cam2_origin}
else
   {level.cam2_origin=$cam_2.origin}
local.camera_trigger = spawn triggercamerause "targetname" "cam_trigger_2" target local.camera
local.camera_trigger.origin = ( 0 0 0 )
local.camera_trigger setsize ( -30 -30 -30 ) ( 30 30 30 )
local.camera_trigger nottriggerable
local.player = parm.other
local.camera_trigger doUse local.player
local.player physics_off
local.player stufftext "ui_hud 0"
local.camera lookat $cam_target_2
local.camera watch "$cam_target_2"
wait .5
while (local.player.useheld != 1)
   {waitframe}
local.player physics_on
local.player stufftext "ui_hud 1"
$cam_2 delete
level.cam2_removed=1
local.camera_trigger delete
$cam_switch_2 triggerable
end

secCam1TargetMover:
while(1)
{
   $cam_target_1 moveto (### ### ###)// enter the coord in the map that you want the camera target to move so that the camera will watch it
   $cam_target_1 waitmove
   wait 2
   $cam_target_1 moveto (### ### ###)// enter the coord in the map that it originally started at
   $cam_target_1 waitmove
   wait 2
}
end
also, you might be able to just tell $secCam1 to lookat and watch the target also, by using this thread INSTEAD OF the original secCam1Controller:

Code: Select all

secCam1Controller:
while(1)
{
   $secCam1 lookat $cam_target_1
   $secCam1 watch "$cam_target_1"
}
end
that might work but i dont know, i havent tried it.... but now im going to cuz im curious haha

Posted: Wed May 03, 2006 8:04 pm
by Ophisâ„¢
well, im using the following now,

Code: Select all

main:

      level waittill prespawn

thread secCam1Controller
   $secCam1Eye bind secCam1
   $secCam1 time 3 // this sets the speed that the camera will rotate - higher = slower, lower = faster

      level waittill spawn

end

secCam1Controller:
while(1)
{
   $secCam1 rotateyupto 30 // rotates the camera 30 degrees
   $secCam1 waitmove // waits until the camera has stopped turning
   wait 3 // waits 3 seconds after the camera has stopped turning
   $secCam1 rotateydownto -30 // rotates the camera back the other way
   $secCam1 waitmove // waits until the camera has stopped turning
   wait 3 // waits 3 seconds after the camera has stopped turning
   waitframe
}
end


activate_cam_1:
$cam_switch_1 nottriggerable
local.camname = "cam_1"
local.camera = $(local.camname)
if (level.cam1_removed)
   {local.camera = spawn Camera targetname local.camname origin level.cam1_origin}
else
   {level.cam1_origin=$cam_1.origin}
local.camera_trigger = spawn triggercamerause "targetname" "cam_trigger_1" target local.camera
local.camera_trigger.origin = ( 0 0 0 )
local.camera_trigger setsize ( -30 -30 -30 ) ( 30 30 30 )
local.camera_trigger nottriggerable
local.player = parm.other
local.camera_trigger doUse local.player
local.player physics_off
local.player stufftext "ui_hud 0"
local.camera lookat $cam_target_1
local.camera watch "$cam_target_1"
wait .5
while (local.player.useheld != 1)
   {waitframe}
local.player stufftext "ui_hud 1"
local.player physics_on
$cam_1 delete
level.cam1_removed=1
local.camera_trigger delete
$cam_switch_1 triggerable
end

activate_cam_2:
$cam_switch_2 nottriggerable
local.camname = "cam_2"
local.camera = $(local.camname)
if (level.cam2_removed)
   {local.camera = spawn Camera targetname local.camname origin level.cam2_origin}
else
   {level.cam2_origin=$cam_2.origin}
local.camera_trigger = spawn triggercamerause "targetname" "cam_trigger_2" target local.camera
local.camera_trigger.origin = ( 0 0 0 )
local.camera_trigger setsize ( -30 -30 -30 ) ( 30 30 30 )
local.camera_trigger nottriggerable
local.player = parm.other
local.camera_trigger doUse local.player
local.player physics_off
local.player stufftext "ui_hud 0"
local.camera lookat $cam_target_2
local.camera watch "$cam_target_2"
wait .5
while (local.player.useheld != 1)
   {waitframe}
local.player physics_on
local.player stufftext "ui_hud 1"
$cam_2 delete
level.cam2_removed=1
local.camera_trigger delete
$cam_switch_2 triggerable
end  
the above moves the cam just as i want it, however im using this bit after the above...

Code: Select all

secCam1TargetMover:
while(1)
{
   $cam_target_1 moveto ( 192 512 88 )// enter the coord in the map that you want the camera target to move so that the camera will watch it
   $cam_target_1 waitmove
   wait 3
   $cam_target_1 moveto ( -40 256 88 )// enter the coord in the map that it originally started at
   $cam_target_1 waitmove
   wait 3
}
end
The cam itself moves, but when "veiwing" the screen doesn't move.

(Just to check, to get the coords for the cam target i was right to go into mohrad and look at its "origin" then move it where i wanted and look at its new "origin" right?)


**********EDIT***********

Just tryed using...

Code: Select all

secCam1Controller:
while(1)
{
   $secCam1 lookat $cam_target_1
   $secCam1 watch "$cam_target_1"
}
end
like you said, this makes the cam still move as i wish, meaning the target must be moving.. so why cant i see it move when i use the cam in game?

Posted: Thu May 04, 2006 12:44 am
by HDL_CinC_Dragon
hmm im not too sure. but yes you were very right to look up the orignal origin and im proud of you for thinking of that heh


when you activate the camera does the view actually follow the target? or does the view still stay in one spot?

Posted: Thu May 04, 2006 1:18 am
by Ophisâ„¢
when i look through the cam in game, the i see just the start point veiw. It doesnt move at all. However if the script tells the brushes that make up the cam to move by following the target.. why isnt my veiw doing that either?!?! lol weird

Posted: Thu May 04, 2006 2:02 am
by HDL_CinC_Dragon
the visible camera part and the actual viewing part are different... heres an idea you can try but might not work. Replace current secCam1Controller with this one and add the $cam_1 time 3 line in the right spot.

Code: Select all

main:
yadda yadda yadda


$cam_1 time 3 // put this right under "$secCam1 time 3"


end



secCam1Controller:
while(1)
{
   $secCam1 rotateyupto 20
   $cam_1 rotateyupto 20
   $secCam1 waitmove
   wait 2
   $secCam1 rotateydownto -20
   $cam_1 rotateyupto 20
   $secCam1 waitmove
   wait 2
   waitframe
}
end
dunno if itll work but give it a shot