Author Topic: cutscene problem....  (Read 494 times)

Legacy_Jacen Saracen

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
cutscene problem....
« on: August 03, 2010, 09:24:50 am »


               I have the following script--

void main()
{
 object oPC = GetFirstPC();
 object oValance = GetObjectByTag("Valance");
 effect eVis = EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY);
// float fFacing = GetFacing(oPC);
   if (!GetIsPC(oPC)) return;
   BlackScreen(oPC);
   DelayCommand(1.0, SetCameraMode(oPC, CAMERA_MODE_CHASE_CAMERA));
   DelayCommand(2.0, AssignCommand(oPC, SetCameraFacing(0.0, 1.0, 80.0, CAMERA_TRANSITION_TYPE_SNAP)));
   DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, oPC));
   DelayCommand(3.0, FadeFromBlack(oPC, FADE_SPEED_SLOWEST));
   DelayCommand(3.1, SetCutsceneMode(oPC, TRUE));
 float fCount = 5.0;
   while (fCount < 50.0)
    {   DelayCommand(fCount, AssignCommand(oPC, SetFacingPoint(GetPosition(oValance))));
        DelayCommand(fCount, AssignCommand(oPC, SetCameraFacing(GetFacing(oPC), 1.0, 80.0, 0)));
        fCount = (fCount + 0.1);
    }
}

What it is supposed to do is have the camera smoothly turn to keep an NPC (oValance) centered visually as the NPC walks by, and the script works fine.  However, as of 1.62, GetFacing() now rounds its response to the nearest degree.  As a result, the camera turns to follow the NPC just fine, but choppily, not smoothly via fractions of degrees.....

Any ideas as to what I could do to achieve a smooth turn?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
cutscene problem....
« Reply #1 on: August 05, 2010, 09:25:22 pm »


               It is currently doing what you are telling it to do.  You have this. 

DelayCommand(fCount, AssignCommand(oPC, SetCameraFacing(GetFacing(oPC), 1.0, 80.0, 0)));


That last 0 you have for the camara transistion type Is telling the camara to snap to location. 

Per nwscript the values are.  

int CAMERA_TRANSITION_TYPE_SNAP = 0;
int CAMERA_TRANSITION_TYPE_CRAWL = 2;
int CAMERA_TRANSITION_TYPE_VERY_SLOW = 5;
int CAMERA_TRANSITION_TYPE_SLOW = 20;
int CAMERA_TRANSITION_TYPE_MEDIUM = 40;
int CAMERA_TRANSITION_TYPE_FAST = 70;
int CAMERA_TRANSITION_TYPE_VERY_FAST = 100;


I would suggest trying something in the the middle of the pack to see how it works and adjusring from there. 

So : 
DelayCommand(fCount, AssignCommand(oPC, SetCameraFacing(GetFacing(oPC), 1.0, 80.0, 40))); 

or 

DelayCommand(fCount, AssignCommand(oPC, SetCameraFacing(GetFacing(oPC), 1.0, 80.0, CAMERA_TRANSITION_TYPE_MEDIUM)));
               
               

               
            

Legacy_Jacen Saracen

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
cutscene problem....
« Reply #2 on: August 06, 2010, 02:38:56 am »


               Thanks. I tried that already. The problem is that if the rate of turn starts out slow enough to smooth out the jitter at the extreme beginning and extreme end of the turn, then it is also too slow to keep the NPC centered properly during the relatively quick-moving middle of the sweep.

I found a solution, however.
Instead of following the character, the camera starts rotating at a specific time and rotates a specific number of degrees at a specific rate. Not exactly the move I'm looking for, since it starts, middles and finishes all at the same speed and does not properly keep the NPC precisely centered, but it does get the basic move down.
               
               

               


                     Modifié par Jacen Saracen, 06 août 2010 - 01:39 .