Hi everyone,
I’m having an issue with triggering an animation on a secondary layer using PlayCanvas’s Anim Component (Anim State Graph).
Setup:
-
I have a Base Layer for movement (Idle, Walk, Run).
-
I created a secondary layer for upper-body actions (Shooting / Attack).
-
The secondary layer starts at an
emptystate (connected fromSTART). -
There is a transition from
emptytorifel shootingtriggered by a parameter calledshootTrigger(Type:Trigger). -
There is an exit transition from
rifel shootingback toemptywithHas Exit Time = true(Exit Time = 1).
In Script (PlayerLogic.js): When pressing Space, I call:
JavaScript
var anim = this.getAnimComponent();
if (anim) {
if (anim.layers) {
for (var i = 0; i < anim.layers.length; i++) {
anim.layers[i].weight = 1.0;
}
}
anim.setTrigger('shootTrigger');
}
The Problem: The console.log fires and confirms anim.setTrigger('shootTrigger') is executed, but the shooting animation never plays on the character model.
Am I missing a specific layer blending/mask setting, or do triggers need to be handled differently across multiple layers in the Anim Component?
Any guidance would be greatly appreciated!