playcanvas / playcanvas/engine

Anim Blend Tree accessor override

Open
#6,217 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: animation
Dominant language
JavaScript
Stars
16.8k
Forks
2k
Avg merge
4h 32m
Merged PRs (30d)
222

Description

A followup on #6211:

Anim Blend Tree overrides the inherited weight accessor from Anim Node:

https://github.com/playcanvas/engine/blob/b27ce4537fd417c40230b0ec1cc8b32f287c3e3b/src/framework/anim/controller/anim-blend-tree.js#L61-L63

https://github.com/playcanvas/engine/blob/b27ce4537fd417c40230b0ec1cc8b32f287c3e3b/src/framework/anim/controller/anim-node.js#L62-L68

Solution:
The accessor should be removed from the Anim Blend Tree (or a setter added), and the Anim Node should add a conditional calculateWeights call:

get weight() {
    this.calculateWeights?.();
    return this._parent ? this._parent.weight * this._weight : this._weight;
}

Repro:
https://playcanvas.com/project/1205544/overview/blend-tree-forked

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked definitions in src/framework/anim/controller/anim-blend-tree.js and src/framework/anim/controller/anim-node.js, then compare the inherited and overriding weight accessors. Verify the change against the linked blend-tree reproduction; done means the accessor behavior is consistent and the reported blend-tree issue no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
game-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.