|
Post by ghosttales on Nov 25, 2018 20:26:58 GMT
Hey all,
So I want to make most of my game animation control based, meaning I want to handle a lot of the logic from animation events. Right now, it seems that during an attack animation, your movement and rotations are locked, with the option to free movement after a certain period of time during the attack.
I want to allow rotation movement only, for a specific frame of each attack. Basically this would allow you to start an attack while facing one direction, but allows for a brief moment to snap it into another creating an interesting dynamic. I was wondering which functions and scripts handle the locking of movement and rotations when using an attack, and if there is a simple way to temporarily allow rotation movement by using a public function on an animation event which function would I call?
I hope I've made this easy to understand, if anybody needs me to be more clear please just ask :^)
Any help is appreciated! Thanks.
|
|
|
Post by Invector on Nov 26, 2018 12:43:15 GMT
Hmm currently you can enable after a period of time using the "Allow Movement At" as you mentioned, but if you want to enable and disable you will need to do some modifications.
You could create a new verification to use with Animation Events and only apply the "Attack" with controlled events like "EnableAttack" - "DisableAttack", and for that you will need to do some changes, for example in the vMeleeCombatInput which has the method that controls the lock movement when attacking
protected virtual void UpdateAttackBehaviour() { if (cc.IsAnimatorTag("Attack")) return; // lock the speed to stop the character from moving while attacking cc.lockSpeed = cc.IsAnimatorTag("Attack") || isAttacking; // force root motion animation while attacking cc.forceRootMotion = cc.IsAnimatorTag("Attack") || isAttacking; }
Perhaps replacing this method, with a custom method to enable/disable using your animation events could be the way
|
|
|
Post by ghosttales on Nov 26, 2018 17:43:14 GMT
Hmm currently you can enable after a period of time using the "Allow Movement At" as you mentioned, but if you want to enable and disable you will need to do some modifications. You could create a new verification to use with Animation Events and only apply the "Attack" with controlled events like "EnableAttack" - "DisableAttack", and for that you will need to do some changes, for example in the vMeleeCombatInput which has the method that controls the lock movement when attacking protected virtual void UpdateAttackBehaviour() { if (cc.IsAnimatorTag("Attack")) return; // lock the speed to stop the character from moving while attacking cc.lockSpeed = cc.IsAnimatorTag("Attack") || isAttacking; // force root motion animation while attacking cc.forceRootMotion = cc.IsAnimatorTag("Attack") || isAttacking; } Perhaps replacing this method, with a custom method to enable/disable using your animation events could be the way Cheers! Thanks pal :^)
|
|
|
Post by ghosttales on Nov 26, 2018 18:37:51 GMT
Hmm currently you can enable after a period of time using the "Allow Movement At" as you mentioned, but if you want to enable and disable you will need to do some modifications. You could create a new verification to use with Animation Events and only apply the "Attack" with controlled events like "EnableAttack" - "DisableAttack", and for that you will need to do some changes, for example in the vMeleeCombatInput which has the method that controls the lock movement when attacking protected virtual void UpdateAttackBehaviour() { if (cc.IsAnimatorTag("Attack")) return; // lock the speed to stop the character from moving while attacking cc.lockSpeed = cc.IsAnimatorTag("Attack") || isAttacking; // force root motion animation while attacking cc.forceRootMotion = cc.IsAnimatorTag("Attack") || isAttacking; } Perhaps replacing this method, with a custom method to enable/disable using your animation events could be the wa I just solved it by making a script that handled attack logic, made a function that could control the "allowRotation" from the motor script and I called the function on an animation event for a single frame :^)
|
|