func_camera for one player only

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

This is drivin me nuts :evil:
The camera position and/or direction depends on whether the player is in the same skybox...
As long as he is, well, the camera is looking from local.camera.origin to that $cam_target.
But once I put him into another one, mmm, well I'm not sure where the heck the camera's looking at or from where... It seems to then depend on it's relative position to the player, but I'm not sure bout this.
Can anbody help, please?
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Do lookat before fov then. ;)

Lol, from one skybox to another? Are you trying to make some kind of a Chronicles of Narnia map? :P

We definitely need some more info.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Rookie One.pl wrote:Do lookat before fov then. ;)
Doesn't help, the camera simply ignores that command. U could d/l the pk3 in my 1st post here and try urself...

What's Chronicles of Narnia? :shock: Never heard of... Anyway, I had the idea of putting different areas of the map into different skyboxes to improve the fps. These areas are connected via teleporters, so no problem there. In the main area, there shall be a control room where u can take a look on screen(s) of what's happening in the other area(s) in birdview.

Will do some more tests... :?
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Oh, didn't know there's a PK3 in the thread. I'll download it and see what I can do.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

I did it a different way, I set it up so only the allies could use it to witness a bombing they jus ordered.
Heres Wacko's script

Code: Select all

main:
end

activate_cam: 
$cam_switch nottriggerable //there's a trigger_use with targetname/cam_switch in the map to enter surveiance mode
local.camname = "cam"
local.camera = spawn Camera targetname local.camname
local.camera.origin = ( 256 256 256 ) 
local.campos=$cam.origin

local.camera_trigger = spawn triggercamerause "targetname" "cam_trigger" target local.camname 
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
$cam lookat $cam_target //there's a script_origin with targetname/cam_target where the camera shall look at

huddraw_shader 200 "textures/cam/camera_overlay"
huddraw_align 200 left top
huddraw_rect 200 0 0 640 480
huddraw_virtualsize 200 1
huddraw_color 200 1 1 1
huddraw_alpha 200 1

wait .5
while (local.player.useheld != 1)
{waitframe}
local.player physics_on
huddraw_align 200 left top
huddraw_rect 0 0 0 0 0
huddraw_virtualsize 0 0
huddraw_color 200 0 0 0
huddraw_alpha 200 0
$cam delete 
$cam_trigger remove 
$cam_switch triggerable 
end
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Green Beret wrote:...Heres Wacko's script...
Ummm, errr, yes, that's my script. Soo?
It 's somewhat different to what I posted earlier but imho it doesnt make much difference.
Dunno why I set local.campos though :roll: Doesnt make sense...
But the problems stay the same: A camera's FOV can't be set and once the cam is in a different skybox, umm, it behaves differently. It still is looking at the $cam_target but from somewhere else than the set local.camera.origin
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

lol, Jus posted it for everyone to look at.
I been messing around wit it, Nothing yet tho :(

Why would a skybox screw wit the view, That is frustrating :?
Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

I am just wondering if it is because vis is stopping the camera from drawing . It is like that sound mod where the sound entity was put inside a vis leafgroup and when you where outside of it you did not hear the sound . Maybe if you tried the alwaysdraw command it may work .

*edit I just took the map and put a wall down the middle to make two sky boxes it seem to work the same as before
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Umm, it's somehow different...
I made another test map u can download here. It got the second skybox. It's just copy/paste of the 1st (and adjusting the trigger's targetname and setthread and the targetname of this 2nd script_origin). In the first skybox, I made another monitor where u could take a look into skybox #2. Then, I duplicated the script of cam_1 and adjusted the code like below.
Now where I ought to see the same as in #1, the 2nd camera's view is completely different...

Code: Select all

activate_cam_1: 
$cam_switch_1 nottriggerable
local.camname = "cam_1"
local.camera = spawn Camera targetname local.camname
local.camera.origin = ( 256 256 256 )
local.camera_trigger = spawn triggercamerause "targetname" "cam_trigger_1" target local.camname 
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
$cam_1 lookat $cam_target_1
wait .5
while (local.player.useheld != 1)
{waitframe}
local.player physics_on
$cam_1 delete 
$cam_trigger_1 remove 
$cam_switch_1 triggerable 
end

activate_cam_2: 
$cam_switch_2 nottriggerable
local.camname = "cam_2"
local.camera = spawn Camera targetname local.camname
local.camera.origin = ( 1792 -1280 -1024 ) 
local.camera_trigger = spawn triggercamerause "targetname" "cam_trigger_2" target local.camname 
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
$cam_2 lookat $cam_target_2
wait .5
while (local.player.useheld != 1)
{waitframe}
local.player physics_on
$cam_2 delete 
$cam_trigger_2 remove 
$cam_switch_2 triggerable 
end
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Well I got it to work but I had to make a func_camera in radiant and I used this script
activate_cam_2:
$cam_switch_2 nottriggerable
local.camname = "cam_2"
local.camera = $(local.camname) //spawn func_Camera targetname local.camname
//local.camera.origin = $cam_2.origin //( 1792 -1280 -1024 )
local.camera_trigger = spawn triggercamerause "targetname" "cam_trigger_2" target local.camera //local.camname
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.camera lookat $cam_target_2
wait .5
while (local.player.useheld != 1)
{waitframe}
local.player physics_on
cueplayer
local.camera_trigger delete
$cam_switch_2 triggerable
end
I guess it is like the func_beam not all things work unless you make it in radiant . I tried to use cut but that did not seem to want to work so I used cueplayer but that probably will stop all cameras if two players are useing cameras at the same time .
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Hey thanks, this is coool :D And it's way better to place the cam in radiant anyway because I wont have to look up the correct coordinates 8-)
In my special case, there'll be only one player anyway looking at the screens, so the cueplayer would be no problem.
On the other hand, I tried the script below and afaics its working, too :) the test map is updated, btw :wink:

Code: Select all

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 
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

You know too you can move and rotate the camera too .
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

bdbodger wrote:You know too you can move and rotate the camera too .
Yeah, probably. No idea how, lol. But for what I do right now, I don't need it.
Once my pc is back again (hdd crash :cry: ), I'll put some (static, moving, following) cameras into the recycling bin and I'll be happy to get ur assistance in this task then...
Thanks a lot so far :D
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

ok actually rotateing isn't easy the camers works a bit strange . I have used orbit ok and lookat but watch seems buggy . I know you can get them to follow spline paths but that does not help with this .
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

bdbodger wrote:ok actually rotateing isn't easy the camers works a bit strange . I have used orbit ok and lookat but watch seems buggy . I know you can get them to follow spline paths but that does not help with this .
Maybe it is easier to move the target then? The cam ought to follow. Ummm, maybe :wink:
Post Reply