- Joined
- Nov 28, 2022
- Messages
- 151
- Reaction score
- 50
[Tutorial] Rotation 180º Char [FrontEnd]
Only one code has been changed, the main code is quoted from this person@LukasCCB
forum.ragezone.com
Only one code has been changed, the main code is quoted from this person@LukasCCB
[Tutorial] Rotation 180º Char [FrontEnd]
Demo:Findstatic int LoginMenuExitFlag = 0;and add code below! static float playerRot = 0; Findm_Player->SetPosition(playerPosCreate);and add code below! In red text you can edit and put other key. int mMX=Mouse->m_MouseMoveX; float glb_MouseSensAdj = 1.0f; // in range (0.1 -...
forum.ragezone.com
Add this instead of this code and the character will return to its previous state after being thinned
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);
change
Code:
// 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;
}

