About Store Forum Documentation Contact



Post Reply 
360 Degree Rotation
Author Message
zyzix Offline
Member

Post: #1
360 Degree Rotation
Hello People,

I have following problem. I am using the "World and Character" Example and added a Third-person Camera. The problem i have is, that the player always points to the camera direction. My question is how can i separate the Player direction from the Camera direction, so that i have a sort of 360° roaming camera around the player, like in modern Jump n' Runs.

If you know the Techdemo "Physical Clothing" here on the website - that is the sort of camera I'd like to achieve.

I've searched the examples and Forums but i could not find anything that helped me so far. Thank you in advance smile

My Camera Code:

Code:
if(!action) // if the character isn't controlled by an automatic action, we can set the input
   {
      // turn & move
      input.anglei.x=Kb.b(KB_Q)-Kb.b(KB_E);
      input.anglei.y=Kb.b(KB_T)-Kb.b(KB_G);
      input.diri  .x=Kb.b(KB_D)-Kb.b(KB_A);
      input.diri  .z=Kb.b(KB_W)-Kb.b(KB_S);
      input.diri  .y=Kb.b(KB_SPACE)-Kb.b(KB_LSHIFT);

      // dodge, crouch, walk, jump
      input.dodge = Kb.bd(KB_D)-Kb.bd(KB_A);
      input.crouch= Kb.b (KB_LSHIFT);
      input.walk  = Kb.b (KB_LCTRL );
      input.jump  =(Kb.bp(KB_SPACE) ? 3.5 : 0);

      // mouse turn
      Flt max=DegToRad(900)*Tm.d(),
          dx =Ms.dir_ds.x*1.7,
          dy =Ms.dir_ds.y*1.7*Ms.inv();
      angle.x-=Mid(dx,-max,max);
      angle.y+=Mid(dy,-max,max);
   }

and the Camera code at Player::Update
Code:
Cam.setSpherical(Players[0].ctrl.actor.pos()+Vec(0,1,0),Players[0].angle.x,Players[0].angle.y,0,Cam.dist*ScaleFactor(Ms.wheel()*-0.2)).updateVelocities().set(); // update camera according to player angles and mouse wheel
01-26-2010 03:05 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: 360 Degree Rotation
please check "camera modes" tutorial (and VIEW_ISO type of view)
01-26-2010 04:28 PM
Find all posts by this user Quote this message in a reply
Post Reply