[Tutorial] Rotation 180º Char [FrontEnd]
Demo:
https://www.youtube.com/watch?v=FU0ueMMmsaQ
Find
Code:
static int LoginMenuExitFlag = 0;
and add code below!
Code:
static float playerRot = 0;
Find
Code:
m_Player->SetPosition(playerPosCreate);
and add code below!
In
red text you can edit and put other key.
Code:
int mMX=Mouse->m_MouseMoveX; float glb_MouseSensAdj = 1.0f; // in range (0.1 - 1.0) float mmoveX = float(-mMX) * glb_MouseSensAdj; if( Mouse->IsPressed(r3dMouse::mRightButton) ) { playerRot += mmoveX; if(playerRot > 180) playerRot = 180; if(playerRot < -180) playerRot = -180; }
Find
Code:
m_Player->m_fPlayerRotationTarget = m_Player->m_fPlayerRotation = 0;
and replace this code
Code:
m_Player->m_fPlayerRotationTarget = m_Player->m_fPlayerRotation = playerRot;
Credits: I do not remember, call me for real credit
Re: [Tutorial] Rotation 180º Char [FrontEnd]
Nothing to do I did this fucking code like this a two or three years ago with mouse position manipulation and with object manipulation only rotates if the mouse is over the area or over the object
Here is only with the mouse position manipulation
Search for:
Code:
m_Player->m_fPlayerRotationTarget = m_Player->m_fPlayerRotation = 0;
Modify to:
Code:
if(Mouse->IsPressed(r3dMouse::mLeftButton)) // Rotação do Personagem By Yuri-BR
{
extern PlayerStateVars_s CurrentRig;
float glb_MouseSensAdj = CurrentRig.MouseSensetivity * g_mouse_sensitivity->GetFloat();
int mmX = Mouse->m_MouseMoveX;
int mmY = Mouse->m_MouseMoveY;
float moveX = float(-mmX) * glb_MouseSensAdj;
float moveY = float(-mmY) * glb_MouseSensAdj;
int mx, my;
Mouse->GetXY(mx, my);
if(mx >= 400 && mx <= 900 && my >= 100 && my <= 700)
m_Player->m_fPlayerRotationTarget = m_Player->m_fPlayerRotation += moveX;
if(m_Player->m_fPlayerRotationTarget > 180)
m_Player->m_fPlayerRotationTarget = m_Player->m_fPlayerRotation = 180;
if(m_Player->m_fPlayerRotationTarget < -180)
m_Player->m_fPlayerRotationTarget = m_Player->m_fPlayerRotation = -180;
}
With object manipulation I can not find...
Re: [Tutorial] Rotation 180º Char [FrontEnd]
lul thats my code...
Code:
if (Mouse->IsPressed(r3dMouse::mRightButton))
{
save = 1;
r3dVector CamPos(0,0,0);
int mMX=Mouse->m_MouseMoveX;
float glb_MouseSensAdj = g_mouse_sensitivity->GetFloat();
static float camangle = 0;
camangle += float(-mMX) * glb_MouseSensAdj;
if(m_Player->m_fPlayerRotationTarget = m_Player->m_fPlayerRotation > 360.0f ) m_Player->m_fPlayerRotationTarget = m_Player->m_fPlayerRotation = 0.0f;
if(m_Player->m_fPlayerRotationTarget = m_Player->m_fPlayerRotation < -0.0f ) m_Player->m_fPlayerRotationTarget = m_Player->m_fPlayerRotation = -0.0f;
m_Player->m_fPlayerRotationTarget = m_Player->m_fPlayerRotation = -camangle;
}