First off I know there are a bunch of “reverse animation problem questions…” but none seem to help with the problem I’m currently having.
I have an object with an animation, the animation is triggered when the player walks into a collider (set up as a trigger).
Following script is attached to this collider:
var targetObject : GameObject;
var targetAnimation : String;
function OnTriggerEnter(other: Collider) {
targetObject.animation[targetAnimation].speed = 1;
targetObject.animation.Play(targetAnimation);
}
function OnTriggerExit(other: Collider) {
targetObject.animation[targetAnimation].speed = -1;
targetObject.animation.Play(targetAnimation);
}
the “targetObject” variable holds the said object which is to run it’s animation and “targetAnimation” is the name of said animation.
the animation wrap mode is “clamp forever” by the way.
The problem I’m having now is following:
- When the player walks into the collider the animation starts immediately (like I want it to)
- Then When the Player leaves the collider the animation reverses with no apparent problem
- But know the longer the player stands out of the collider and then steps back in…it takes longer for the animation to begin
- The same when the player stays in the collider for a longer time, the reverse animation then also takes longer to start again.
I’m not really sure whats causing this and I want to thank you for any answers in advance.
I hope to able to contribute to this great community with answers of my own once I’m a more skilled unity user