Topic: [Tutorial] fix rotation issues after Overhead-Throws
Hello.
If you're using Overhead-Throws in your game-project, you might run into problems with the character-rotation.
Here is a small video, how that looks like and how it looks "fixed":
https://www.youtube.com/watch?v=iW6Up8L … e=youtu.be
The idea of our solution is, that during the standup-animation of the thrown character the script "decides" in which direction the character is facing. That function is already built in (ControlScript.cs -> validate Rotation()), but unfortunately it doesn't work für basic-moves.
So we only had to add a few lines of code:
Open ControlScript.cs and search for "private void validateRotation()"
change this:
private void validateRotation(){
if (!myPhysicsScript.IsGrounded() || myPhysicsScript.freeze || currentMove != null) fixCharacterRotation();
if (myPhysicsScript.freeze) return;
if (currentState == PossibleStates.Down) return;
if (currentMove != null) return;
if (myPhysicsScript.IsJumping() && !UFE.config.characterRotationOptions.rotateWhileJumping) return;
if (currentSubState == SubStates.Stunned && !UFE.config.characterRotationOptions.fixRotationWhenStunned) return;
if (isBlocking && !UFE.config.characterRotationOptions.fixRotationWhenBlocking) return;
if (UFE.config.characterRotationOptions.rotateOnMoveOnly && myMoveSetScript.IsBasicMovePlaying(myMoveSetScript.basicMoves.idle)) return;
testCharacterRotation(UFE.config.characterRotationOptions._rotationSpeed);
}
to this:
private void validateRotation(){
if (!myPhysicsScript.IsGrounded() || myPhysicsScript.freeze || currentMove != null) fixCharacterRotation();
if (myPhysicsScript.freeze) return;
if (currentState == PossibleStates.Down && stunTime > 0.4) return; // start rotation of the standup-animation if stunTime is <= 0.4
if (currentMove != null) return;
if (myPhysicsScript.IsJumping() && !UFE.config.characterRotationOptions.rotateWhileJumping) return;
if (currentSubState == SubStates.Stunned && !UFE.config.characterRotationOptions.fixRotationWhenStunned) return;
if (isBlocking && !UFE.config.characterRotationOptions.fixRotationWhenBlocking) return;
if (UFE.config.characterRotationOptions.rotateOnMoveOnly && myMoveSetScript.IsBasicMovePlaying(myMoveSetScript.basicMoves.idle)) return;
// set rotationspeed to 9.0 for standupanimation-rotation or set to _rotationSpeed
if (currentState == PossibleStates.Down)
{
testCharacterRotation(9.0f);
}
else
{
testCharacterRotation(UFE.config.characterRotationOptions._rotationSpeed);
}
}
Don't forget to adjust the rotation-speed (in the example 9.0f). Have a look at our video: The rotation starts, when the character has placed both feet on the ground and is standing up.
We put the values directly into the code, because we would have to change two more scripts for accessing the values via character- or move-editor.
Some requirements:
- Don't use root motion for your throws. Instead use "Self Applied Forces".
- Don't rotate your animations inside the move-editor (see image below for correct setup).
- The opponents throw-reaction should end with the character laying on the ground and match the first frame of the standup-animation (see image below)
- For the standup-animation of the attacking character, you can use "Auto Rotation" in the move-editor and setup the starting-frame (it's not a basic move, so it should work)
I don't know if our solution works for everyone and for every move, but it helped us to solve the rotation problem. The rotation-solution is anatomical not correct, but it looks ok if it's played fast enough.
Hope it helps
shubi