[til 1.15.2 preX] [CEM] globalized model variables
This is a pretty wheired issue, as of its wheired behavior. Sadly, its kinda hard to display without a gif, so I'm gonna explain this as good as i can!
Description of Issue
Imagine, having multiple mobs of the same kind, and when an animation on one of those is running, the animation is playing on every mob of that kind on the world! Example: Im havin a BB-8, that rolls his body when moving arround, but as it moves, the body of every BB-8 in the world is rolling.
The left 2 ones are just NoAI:1b ones, so they cannot move and get the animation played! The one on the right just moved and so the bottom cube is rolling. As we see, every BB-8 has its cube turned by the same anmount of degrees.
Steps to Reproduce
So, I think, the game is producing that error due to a globalization of the else value as a model variable in if(cond, val, [cond2, val2, ...], val_else)
I used that code:
"animations": [
{
"body:body_sub.rx": "if(limb_speed > 0.0001, body:body_sub.rx + limb_speed * 0.1, body:body_sub.rx)", <- Here's globalization
"body:body_sub_2.rx": "limb_speed * -0.5" <- Here we don't have globalization
}
]
OptiFine Version
I've tested it in 1.14.4 and 1.15.2 pre-26
Additional Information
If this is normal, and I was just to stupid to get it, correct me! And if you know an easier way to make something spin, depending on the movement speed, please tell me ;=).
Edit: this even happens when just doing: "model.variable + limb_speed * some value"
I'm sure you probably solved it by now, but for anyone with this issue it's a simple solution: don't use limb_speed I swapped it limb_swing and it gets the desired spinning motion without globalization
"model.variable": "(limb_swing *value)"
this is fixed by the addition of entity variables. do not set a bones animation to its own value. use variables instead https://github.com/sp614x/optifine/blob/master/OptiFineDoc/doc/cem_animation.txt#L47