Re: FPS Camera
setting the camera should be done each frame, not at the game initialization stage
move
"OrientP &head=Players[0].cskel.getPoint("Head"); // some sort of array for storing player objects right?, i assume 0 is the player walking around because there are no other players.
//Cam.setSpherical(Vec(16,0,16),-PI_4,-0.5,0,10).set(); // set initial camera. commented out because im trying my own camera, I think this is right, not sure
Cam.setPosDir(head.pos, head.dir, head.perp).set(); //i added .set() i think this makes it as the active camera"
this into the "Main" function
and always when you want to access Players[0] you need to check first if there is actually 0-th element
if(Players.elms()>1)
{
OrientP &head=Players[0].cskel.getPoint("Head"); // some sort of array for storing player objects right?, i assume 0 is the player walking around because there are no other players.
//Cam.setSpherical(Vec(16,0,16),-PI_4,-0.5,0,10).set(); // set initial camera. commented out because im trying my own camera, I think this is right, not sure
Cam.setPosDir(head.pos, head.dir, head.perp).set(); //i added .set() i think this makes it as the active camera
}
the crash is caused by accesssing a non existing object (at initialization Players has 0 elements)
|