About Store Forum Documentation Contact



Post Reply 
camera movement whoops
Author Message
dbuman Offline
Member

Post: #1
camera movement whoops
Ok so I was going to make the mouse show and hide, and when I tried implementing it, the camera stopped moving when i spawned.

I deleted the code that caused the problem and now, it is still not moving.

Ive gone over and over the code, and I have this for the camera code:

Code:
if(View==VIEW_TPP)
      {
         Vec offset = Vec(0);
         if (OrientP *p = Players[0].cskel.findPoint((Str8)L"Head")) {offset = p->cross() * 0.25f;}
         Cam.setSpherical(Players[0].ctrl_center+Vec(offset.x,1,offset.z), Players[0].angle.x, Players[0].angle.y, 0, Cam.dist*ScaleFactor(Ms.wheel()*-0.2));
      }
      else {
      if(View==VIEW_FPP)
      {
         if(OrientP *head_point=plr.cskel.findPoint(8"Head"))
         {
            OrientP head =*head_point;
            Vec     up   =!PointOnPlane(Vec(0,1,0), head.dir);
            Flt     blend=Sat((1-Abs(head.dir.y))/0.25)*0.5;
                    head.perp=Lerp(head.perp, up, blend); // move 'up' towards Vec(0,1,0) to reduce head rolling
                    head.fixPerp();
            Cam.setPosDir(head.pos, head.dir, head.perp);
         }else
         {
            Cam.setAngle(plr.ctrl_center, plr.angle.x, plr.angle.y);
         }
      
      }
      }
        
        Cam.updateVelocities().set();
      
   }else
   {
      CamHandle(0.1, 200, Ms.b(0) ? CAMH_MOVE_XZ : CAMH_ZOOM|(Ms.b(1)?CAMH_MOVE:CAMH_ROT));
   }

Is there anything that I did that caused the camera not to move with the mouse movement?
06-26-2011 03:54 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: camera movement whoops
Looks like you have too many } brackets... Make a new view mode called VIEW_FREE or something and use multiple if/else if statements (like you're doing) or a single switch statement. Be sure you have equal amounts of { and } brackets.

Code:
if (View == VIEW_TPP) {
    // ...
} else if (View == VIEW_FPP) {
    // ...
} else if (View == VIEW_FREE) {
    // CamHandle...
}
06-26-2011 05:05 AM
Find all posts by this user Quote this message in a reply
dbuman Offline
Member

Post: #3
RE: camera movement whoops
Ok so i figured it out, even though the code didnt originally have it, i set plr.angle.x and plr.angle.y = Ms.d().x and Ms.d().y

It made it so when i moved my mouse, the camera and the character's body followed.

simple change but yet I dont know why it caused it.

All this because I wanted to set up new views and cause the mouse to be usable on a gui.

alls well now though, when I hit tab, the mouse appears, disables the ms.bp(0) from being used for attacks, and allows it for button clicks.
06-26-2011 06:02 AM
Find all posts by this user Quote this message in a reply
Post Reply