Aller au contenu

Photo

How to pin the camera


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

#1
el.sombrero

el.sombrero
  • Members
  • 100 messages
Hi there fellows

 I'm creating a maze and I would like that each time the player faces a bifurcation, the camera angle would be behind him. My idea is to create a trigger at the tile right in front of the bifurcation that arrange the angle change... but couldnt do it yet.
 Can anyone tell me if this is the better (easiest) method to do this? Can anyone tell me how to implemente this trigger system or indicate the faq where I can study it?

 Thx!

#2
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
You could have a conversation start, then set the conversation camera to show the right angle.

#3
el.sombrero

el.sombrero
  • Members
  • 100 messages
Uhm... but this would break the flowing of the maze... you know, there will be plenty of bifurcations there. If I start a conversation each time, the maze will be like a speed date event :0)

#4
kamal_

kamal_
  • Members
  • 5 258 messages
You don't necessarily need to start a conversation with pc lines, a single line barkstring might be sufficient to let you force a camera angle. The barkstring could even be empty on the "npc" side. It might work, it might not.

Another thing to try would be to write a custom version of the RestoreCameraFacing function, since that can apparently be used to set a camera angle as part of a cutscene.

#5
kevL

kevL
  • Members
  • 4 070 messages
you could play around with

void SetCameraFacing(float fDirection, float fDistance = -1.0f, float fPitch = -1.0,
    int nTransitionType=CAMERA_TRANSITION_TYPE_SNAP);

void SetCameraHeight(object oPlayer, float fHeight=0.0f);


Paint a trigger at each junction, that runs a small script using those (nb. i haven't tried this)

Modifié par kevL, 19 avril 2012 - 03:54 .


#6
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
A year ago I tried working with these functions. I can't remember it working that well, but it is certainly worth a shot. I do wonder if it would be disorienting to the player to have the camera snap around at each bifrucation.

#7
kevL

kevL
  • Members
  • 4 070 messages
iirc, they worked very well in NwN1 and i had lots of fun & frustration w/ that! ofc this is NwN2 ...


confusing? you bet, it's a maze :)

#8
el.sombrero

el.sombrero
  • Members
  • 100 messages
Hey guys, thx! Saturday I will have sometime off and will try these out!

#9
el.sombrero

el.sombrero
  • Members
  • 100 messages
hey, tried the

void SetCameraFacing(float fDirection, float fDistance = -1.0f, float fPitch = -1.0,
int nTransitionType=CAMERA_TRANSITION_TYPE_SNAP);

void SetCameraHeight(object oPlayer, float fHeight=0.0f);

it did nothing, any other idea?

#10
kevL

kevL
  • Members
  • 4 070 messages
The following script worked great for me when in Exploration or Character Modes -- Strategy Mode left the view pretty borked tho. Unfortunately there's no GetCameraMode function ... else one could adapt to the player's preferred camera ... an alternative is to force SetCameraMode() and send a message to the player that they need to use Character or Exploration mode to navigate the maze (!),


void main()
{
  if (GetLocalInt(OBJECT_SELF, "bDone")) return;

  object oPC = GetEnteringObject();
  if (!GetIsPC(oPC)) return;

  // from 'x0_inc_generic' GetIsFighting()
  object oAttack = GetAttemptedAttackTarget();
  object oSpellTarget = GetAttemptedSpellTarget();
  if (GetIsObjectValid(oAttack) || GetIsObjectValid(oSpellTarget)) return;

  AssignCommand(oPC, ClearAllActions());
  SetLocalInt(OBJECT_SELF, "bDone", TRUE);

  object oTarget = GetObjectByTag("kg001_ct_dov");

  // from 'ginc_cutscene' SetCameraFacingPoint()
  vector vPC = GetPosition(oPC);
  vector vTarget = GetPosition(oTarget);
  // this gives us a vector pointing from PC to Target
  vector vDifference = vTarget - vPC;
  // we just need the angle of that vector
  float fDirection = VectorToAngle(vDifference);

  AssignCommand(oPC, SetFacingPoint(vTarget));
  AssignCommand(oPC, SetCameraFacing(fDirection, 6.f, 85.f,
      CAMERA_TRANSITION_TYPE_FAST));

  SendMessageToPC(GetFirstPC(FALSE), ". Camera facing theDove, done");
}


#11
el.sombrero

el.sombrero
  • Members
  • 100 messages
Hey KevL... it worked fine for me too. Sweet.
I just erased
// from 'x0_inc_generic' GetIsFighting()
object oAttack = GetAttemptedAttackTarget();
object oSpellTarget = GetAttemptedSpellTarget();
if (GetIsObjectValid(oAttack) || GetIsObjectValid(oSpellTarget)) return;

and

SetLocalInt(OBJECT_SELF, "bDone", TRUE);

Because I thought these wouldnt be helpful in my situation... The script still works ok... Erasing these lines will have any sideffect. By the way, when the camera angle changes, it comes very near the pc... is there a way to force the camera angle but to keep the distance between it and the pc?
thx dude!

#12
kevL

kevL
  • Members
  • 4 070 messages
hey el,

those /attack/ lines can be removed safely if there's no enemies around, yep. the local_int can/should be removed if you want the trigger to work multiple times ( you should also remove the GetLocal since the SetLocal is gone ..)


beware StrategyMode cams ;)


el.sombrero wrote...

By the way, when the camera angle changes, it comes very near the pc... is there a way to force the camera angle but to keep the distance between it and the pc?

not sure what you mean ..

#13
Morbane

Morbane
  • Members
  • 1 883 messages

kevL wrote...

el.sombrero wrote...

By the way, when the camera angle changes, it comes very near the pc... is there a way to force the camera angle but to keep the distance between it and the pc?

not sure what you mean ..


May be because it is backing up to the wall? or a placeable?

#14
el.sombrero

el.sombrero
  • Members
  • 100 messages
Uhm... I will try to explain msyelf... the thing is, when testing the module I usually set the camera as far as possible from the avatar, using the mouse wheel.
I noticed that when the script is triggered and the angle is forced, the camera comes very near the back of the avatar. If, in my original situation, the camera was like 10 feet away from the avatar after the forced angle it comes very near, like 2 ou 3 feet away from it.
Does it have anything to do with the viewmode I'm using? (by the way, how do I change the viewmode? can't remember it)

#15
kevL

kevL
  • Members
  • 4 070 messages
hey El,

the " * " on NumericKeypad cycles through cameraModes,

It sounds like you want to adjust the value " 6.f " for function:

SetCameraFacing(fDirection, 6.f, 85.f, CAMERA_TRANSITION_TYPE_FAST);


- make it bigger to move the camera farther away. As long as, like Morbane says, there isn't a wall or something in the way back there. btw, " 85.f " is the angle down from vertical ...

( 6.f means 6.0 units as a float )