How to rotate character to face attacker when hit?

kentreva

Member
Hi! When the character is hit, I want the character to face the direction of the hit and then start the Damage Visualization ability.

I recorded an example from loz64:

What I've done so far is copy the Damage Visualization ability to a new script lets' call it DamageVisualizationMyVersion and recoded the OnImpact method to handle this logic.
1654543912464.png


1. Is this the right place to do this logic?
2. How do I actually rotate the character? Can you please help with the code here? I'm not very good at this math stuff. Sorry!
 
You can either use the RotateTowards ability directly, or you can reuse the code:
 
Hi thanks. I took a look.
And I saw this in the comments of that ability:
1654648998382.png

I'm thinking of adjusting this motor rotation speed property when my hurt ability starts to some very high number, but I can't find this field?

Do you know what variable this "Motor Rotation Speed" is referring to? I can't find it.
 
1654704945787.png
1654704959514.png

1654704989922.png
These are the only properties with the words "motor" or "rotation" in that script. I meant like is it one of these? The name doesn't match the comment so I was confused if it's a mistake with the comment, or it's just named something different?
 
Ah I see. the Ultimate CHaracter lomotion script inherits from a script that has the
m_MotorRotationSpeed property. Was able to change the speed using
m_CharacterLocomotion.MotorRotationSpeed = rotationSpeed;
 
Top