FixedCamera and script trouble

Topics regarding Scripting with Reality Factory
Post Reply
Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

FixedCamera and script trouble

Post by Danimita92 » Sun Jun 07, 2009 6:57 pm

Hi everybody. I'm trying to make a system of fixed cameras and for now it kind of works. The camera is supposed to be attached to a pawn that does what the camera is supposed to do (Look at the scripted player)
The fixed camera hooks on the camera pawn and grabs its rotation at first, but when the Camera pawn rotates, the fixedcamera doesn't. It just stays there. Still. I tried the commands like

SetFixedCameraRotation(float RotX, float RotY, float RotZ);

But it doesnt seem to do anything... any ideas?

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: FixedCamera and script trouble

Post by Juutis » Wed Jun 10, 2009 2:47 pm

How exactly are you doing this? Are you using the AttachCamera command?
Pain is only psychological.

Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: FixedCamera and script trouble

Post by Danimita92 » Wed Jun 10, 2009 3:40 pm

No. Using EntityName in the fixedcamera entity.

But I managed to do it after a long time.
Problem is it doesn't use the Pawns yaw and pitch. I have to make it look at script points :evil:

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: FixedCamera and script trouble

Post by Juutis » Wed Jun 10, 2009 4:44 pm

If you use a normal camera (not the FixedCamera stuff) you can use AttachCamera to attach the camera to a pawn and the camera will follow and rotate with the pawn.
Pain is only psychological.

Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: FixedCamera and script trouble

Post by Danimita92 » Wed Jun 10, 2009 11:25 pm

But the pitch wont. That's why I'm using FixedCameras

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: FixedCamera and script trouble

Post by Juutis » Thu Jun 11, 2009 2:01 am

Ah, yes. You are correct. You could, however, use the TiltCamera command to modify the pitch of the camera. Requires a bit of work but should be doable.
Pain is only psychological.

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: FixedCamera and script trouble

Post by Juutis » Thu Jun 11, 2009 8:40 pm

Here's a little sample script that makes the camera follow a pawn called 'target'. Also pitch-wise:

Code: Select all

{    
    Spawn[ ()
    {
        Console(true);
        Gravity(false);
        LowLevel("setup");
    } ]
    
    setup[ ()
    {
        PawnRender(false);
        AttachCamera();
        yaw_speed = 10000;
        SetTarget("target");
        think = "run";
    } ]
    
    run[ ()
    {
        ThinkTime = 0;
        
        TiltCamera(enemy_pitch + camera_pitch);
        
        UpdateEnemyVis();
        ideal_yaw = enemy_yaw;
        ChangeYaw();
    } ]
    
}
Note: The pawn you assign this script to must have actorrotation values of '0 180 0' in pawn.ini and the camera must be in first person mode.
Pain is only psychological.

Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: FixedCamera and script trouble

Post by Danimita92 » Fri Jun 12, 2009 6:54 pm

Wow. You're up for any challenge aren't you, Juutis?
The
enemy_pitch + camera_pitch
part is genius. I hadn't even thought about that. Wow.

Post Reply