Post by justsomedev on May 31, 2023 5:00:00 GMT
Hello everyone, I'm trying to alter the swimming script to enable strafe movement. I went and set the strafe locomotion to true and the controller moves in a strafe motion, but it doesn't play the animations that I set in the animator for strafe movements. I set the transition conditions to match the default swimming transitions, but I added the IsStrafing condition to it and it doesn't seem to play the strafe animations that I set when I move left, right or backwards. Is there another section in the script that I need to modify? Or do I need to modify another script? Not sure why it's not playing the other animations.
if (isSwimming)
{
if (tpInput.cc.currentHealth > 0)
{
if (!triggerSwimState)
{
EnterSwimState(); // call once the swim behaviour
}
SwimUpOrDownInput(); // input to swin up or down
tpInput.SetStrafeLocomotion(true); // limit the player to not go on strafe mode (Switch to true or false)
tpInput.MoveInput(); // update the input
tpInput.cc.SetAnimatorMoveSpeed(tpInput.cc.freeSpeed); // update the animator input magnitude
WeakAttackUnderwater(); // input for weak attack underwater
UnderwaterBlock(); // input to block underwater
UnderwaterDash(); // input to dash underwater
}
//else
//{
// ExitSwimState(); // use the trigger around the edges to exit by playing an animation
//}
}
else
{
ExitSwimState();
}
if (isSwimming)
{
if (tpInput.cc.currentHealth > 0)
{
if (!triggerSwimState)
{
EnterSwimState(); // call once the swim behaviour
}
SwimUpOrDownInput(); // input to swin up or down
tpInput.SetStrafeLocomotion(true); // limit the player to not go on strafe mode (Switch to true or false)
tpInput.MoveInput(); // update the input
tpInput.cc.SetAnimatorMoveSpeed(tpInput.cc.freeSpeed); // update the animator input magnitude
WeakAttackUnderwater(); // input for weak attack underwater
UnderwaterBlock(); // input to block underwater
UnderwaterDash(); // input to dash underwater
}
//else
//{
// ExitSwimState(); // use the trigger around the edges to exit by playing an animation
//}
}
else
{
ExitSwimState();
}