Aller au contenu

Photo

Camera facing goes wild, but only some of the time


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
Lovelamb

Lovelamb
  • Members
  • 38 messages
I'm having the nastiest kind of problem for debugging, at least in my experience. It only happens around once in 20 testings, so when I change something, I never know if I corrected it. Today it happened again, but on the next test, without changing anything, it didn't. I know it isn't fixed if I didn't do anything to fix it...

It's about camera position that gets set in the beginning of a cutscene. Most of the time, it faces the same way, in the direction I want it to, but once in a while, just when I was hoping everything is right, it looks maybe 90 degrees to the side, and I get to watch a rat instead of my NPCs speaking strings...

Ideas what this could be?

Before the cutscene, the player gets a conversation. The camera is free during the conversation and the player isn't in cutscene mode.

When they click on End Dialog, this script fires:

object oPC = GetFirstPC();
FadeToBlack(oPC);
DelayCommand(2.0f, ExecuteScript({this script below}, oPC));


Here is the cutscene's code without the NPCs speaking. 

void HandleWeapons(object oPC, float fDur)  // unequip and later equip weapons
{                                                  // (they don't become invisible)

    object oRightHand = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
    object oLeftHand = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);

    if (GetIsObjectValid(oRightHand)) 
    {
        AssignCommand(oPC, ActionUnequipItem(oRightHand));
        DelayCommand(fDur+2.2f, AssignCommand(oPC,
            ActionEquipItem(oRightHand, INVENTORY_SLOT_RIGHTHAND)));
    } 
    if (GetIsObjectValid(oLeftHand)) 
    {
        AssignCommand(oPC, ActionUnequipItem(oLeftHand));
        DelayCommand(fDur+2.2f, AssignCommand(oPC,
            ActionEquipItem(oLeftHand, INVENTORY_SLOT_LEFTHAND)));
    }
}

void main()
{
    object oPC = GetFirstPC();
    object oPCsEndDestination = GetObjectByTag("felpris_pc_wp");
    object oPCPosition = GetObjectByTag("pc_posit_rav_cut1_wp");
    effect eDomi = EffectCutsceneDominated();
    float fDur = 80.0f;
    int nMyAppearanceType = GetAppearanceType(oPC);

    // defined more objects here
    // ...

    // store camera
    StoreCameraFacing();

    // set time to daytime
    SetTime(14, 0, 0, 0);

    // change PC's appearance type
    SetCreatureAppearanceType(oPC, APPEARANCE_TYPE_INVISIBLE_HUMAN_MALE);

    // unequip and later equip weapons (they don't become invisible)
    HandleWeapons(oPC, fDur);

    // ghost effect
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectCutsceneGhost(), oPC, fDur);

    BlackScreen(oPC);

    // camera facing
    DelayCommand(1.0f, AssignCommand(oPC,
        SetCameraFacing(-1.0, 5.0f, 85.0, CAMERA_TRANSITION_TYPE_SNAP)));

    // bring PC, dominate
    AssignCommand(oPC, ActionJumpToObject(oPCPosition));
    DelayCommand(1.2f, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDomi, oPC, fDur-2.0));
    DelayCommand(1.2f, SetCutsceneMode(oPC, TRUE, FALSE));

    // some NPCs move and speak strings
    // ...
    // ...

    // restore camera
    DelayCommand(fDur+1.7f, RestoreCameraFacing());

    // end the cutscene 
    DelayCommand(fDur, FadeToBlack(oPC));
    DelayCommand(fDur+2.0f, SetCutsceneMode(oPC, FALSE));
    DelayCommand(fDur+2.2f, SetCreatureAppearanceType(oPC, nMyAppearanceType));
    DelayCommand(fDur+3.0f, AssignCommand(oPC, ActionJumpToObject(oPCsEndDestination)));
} 

* I realize now that I put -1.0 for the first parameter in SetCameraFacing... I remember trying many things to set the camera to face where I wanted it, uh... Is this the answer?

** Tested it with the waypoint's orientation (which is 200.0) instead of -1.0. It seems to have no impact. I put 200.0 as the first parameter, then turned the WP the other way. Camera faces the same way as the WP, not 200.0.

*** I suspect the problem, given these conditions, is that PC, when jumping to a waypoint, does not always face the same way as the waypoint, even though she's jumping to a different area. But most of the time, she does. So every once in 20 testings, she faces a different way.

Modifié par Lovelamb, 24 décembre 2012 - 11:53 .


#2
Builder__Anthony

Builder__Anthony
  • Members
  • 108 messages
Your probally bumping a wall or something

#3
Lovelamb

Lovelamb
  • Members
  • 38 messages
Or bumping a rat? This is a possibility. I'll ghost effect them both and set facing to that of the WP and pray it doesn't repeat :D