• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[Tutorial] Rotation 180º Char [FrontEnd]

Joined
Apr 23, 2013
Messages
1,172
Reaction score
1,797
Demo:

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;    [COLOR=#ff0000]if( Mouse->IsPressed(r3dMouse::mRightButton) ) [/COLOR]   {        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​
 
Joined
Apr 2, 2013
Messages
1,098
Reaction score
4,625
Nothing to do I did this Ducking 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...
 
Last edited:
Experienced Elementalist
Joined
May 28, 2017
Messages
225
Reaction score
127
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;
    }
 
Skilled Illusionist
Joined
Nov 27, 2018
Messages
339
Reaction score
66
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;
    }

change it

BsFfwYN - [Tutorial] Rotation 180º Char [FrontEnd] - RaGEZONE Forums


code:
m_Player->m_fPlayerRotationTarget = m_Player->m_fPlayerRotation = -camangle;
}

add after:

else
m_Player->m_fPlayerRotationTarget = m_Player->m_fPlayerRotation = 0;
 
Newbie Spellweaver
Joined
Nov 28, 2022
Messages
35
Reaction score
5
C++:
int mMX = Fare->m_MouseMoveX; float glb_MouseSensAdj = 1.0f; // 0.1 ile 1.0 arasında float mmoveX = static_cast<float>(-mMX) * glb_MouseSensAdj; if (Mouse->IsPressed(r3dMouse::mRightButton)) { playerRot += mmoveX; if (playerRot > 180) playerRot = 180; if (playerRot < -180) playerRot = -180; } else if(m_needPlayerRenderingRequest==3) // oyun ekranını oyna m_Player->SetPosition(playerPosCreate);
Add this instead of this code and the character will return to its previous state after being thinned
C++:
// Target rotation value
float targetRot = 0.0f;
// Rotation speed (adjustable)
float rotationSpeed = 1.0f;

if (!Mouse->IsPressed(r3dMouse::mRightButton)) {
    // If the character's rotation is different from the target rotation, reverse the rotation movement
    if (playerRot != targetRot) {
        // Determine the direction of rotation
        float rotationDirection = (playerRot > targetRot) ? -1.0f : 1.0f;
        // Update the rotation
        playerRot += rotationSpeed * rotationDirection;

        // If the rotation speed is slow and it's approximately close to the target, lock the rotation to zero
        if (fabs(playerRot - targetRot) < rotationSpeed) {
            playerRot = targetRot;
        }
    }
}

int mMX = Mouse->m_MouseMoveX;
float glb_MouseSensAdj = 1.0f;
float mmoveX = static_cast<float>(-mMX) * glb_MouseSensAdj;

if (Mouse->IsPressed(r3dMouse::mRightButton)) {
    playerRot += mmoveX;
    if (playerRot > 180) playerRot = 180;
    if (playerRot < -180) playerRot = -180;
}
 
Last edited:
Back
Top