Animator trigger accumulation on other players' prefabs.
Options
matte
✭
hello,
The problem I'm having is that in the animator of a third party player (i.e. a player I'm not the controller of) I can sometimes see the triggers accumulating or duplicating. For example, pressing W and then releasing it, I can see in the animator a succession of WalkTrigger, IdleTrigger, WalkTrigger, and IdleTrigger, which is not correct: I should only see a single pair of triggers firing.
What could be the problem? Could it be that Bolt replicates triggers more than once? My hypothesis is that when I press and release W, Bolt is sendig in succession two Walk Triggers and two IdleTriggers. How can I solve this?
This is the relevant code, in the EntityBehaviour script component of the player prefab:
matte
The problem I'm having is that in the animator of a third party player (i.e. a player I'm not the controller of) I can sometimes see the triggers accumulating or duplicating. For example, pressing W and then releasing it, I can see in the animator a succession of WalkTrigger, IdleTrigger, WalkTrigger, and IdleTrigger, which is not correct: I should only see a single pair of triggers firing.
What could be the problem? Could it be that Bolt replicates triggers more than once? My hypothesis is that when I press and release W, Bolt is sendig in succession two Walk Triggers and two IdleTriggers. How can I solve this?
This is the relevant code, in the EntityBehaviour script component of the player prefab:
public override void Attached() { state.Transform.SetTransforms(transform); state.SetAnimator(GetComponent<Animator>()); state.Animator.applyRootMotion = entity.isOwner; } public override void ExecuteCommand(Bolt.Command command, bool resetState) { PlayerCommand cmd = (PlayerCommand)command; if (resetState) { _motor.SetState(cmd.Result.Position, cmd.Result.Velocity, cmd.Result.IsGrounded, cmd.Result.JumpFrames); } else { PlayerMotor.State motorState = _motor.Move(cmd.Input.Forward, cmd.Input.Backward, cmd.Input.Left, cmd.Input.Right, cmd.Input.Jump, cmd.Input.Yaw); cmd.Result.Position = motorState.position; cmd.Result.Velocity = motorState.velocity; cmd.Result.IsGrounded = motorState.isGrounded; cmd.Result.JumpFrames = motorState.jumpFrames; } AnimatePlayer(cmd); } private void AnimatePlayer(PlayerCommand cmd) { if (cmd.IsFirstExecution) { bool walk = cmd.Input.Forward || cmd.Input.Backward || cmd.Input.Left || cmd.Input.Right; if (walk) { state.Animator.SetTrigger("WalkTrigger"); } else { state.Animator.SetTrigger("IdleTrigger"); } } }Any help is appreciated!
matte
0