kreathyon
Member
|
[SOLVED] Camera no move to head in FPP mode
Hello,
In Player.cpp
Code:
virtual uint drawPrepare()
{
uint draw_mask=0xFFFFFFFF; // set all groups enabled by default
bool hide_head=(View==VIEW_FPP && mesh); // disable drawing head when we're in FPP mode
if(hide_head)FlagDisable(draw_mask, IndexToFlag(DG_CHR_HEAD)); // clear head draw group flag
SetDrawMask(draw_mask); // set draw mask
uint modes=super.drawPrepare(); // call default drawing after setting the mask
SetDrawMask(); // reset default mask
return modes;
}
In Game.cpp
Code:
// Define viewing modes:
enum VIEW_MODE // Viewing Mode
{
VIEW_FPP, // First Person
VIEW_TPP, // Third Person
VIEW_NUM, // number of view modes
}
VIEW_MODE View=VIEW_TPP; // current VIEW_MODE
void UpdateCamera()
{
// set next camera mode when Tab pressed
if(Kb.bp(KB_TAB))
{
View=VIEW_MODE((View+1)%VIEW_NUM);
}
switch(View)
{
case VIEW_FPP:
{
C OrientP *head=Players[0].skel.getPoint(8"head"); // obtain player "head" skeleton point (this was created in Mesh Editor)
Cam.setPosDir(head.pos, head.dir, head.perp); // set camera from 'head' position, direction and perpendicular to direction
}break;
case VIEW_TPP:
{
Cam.dist=Max(1.0, Cam.dist*ScaleFactor(Ms.wheel()*-0.1)); // update camera distance according to mouse wheel
//Cam.setSpherical(Players[0].ctrl.center()+Vec(0, 0.5, 0), Players[0].angle.x, Players[0].angle.y, 0, Cam.dist); // set spherical camera looking at player position with given player angles
}break;
}
}
In bool UpdateGame
In FPP mode head hide but the camera not move to head, help me please thank you
----------------------------
i'm find a solution
(This post was last modified: 08-11-2015 02:23 PM by kreathyon.)
|
|
08-11-2015 08:49 AM |
|