1
I am currently working on a custom pig project, I finished the model and texture yesterday but I'm still stuck on the animations with the ears I added to it. The first step went really smooth adding the animation for the hurt effect: "ear1.rz": "-sin(hurt_time/pi)*1.3", "ear2.rz": "-sin(hurt_time/pi)*-1.3", but I kind got stuck after that with trying to animate the ears to always move while the pig is walking. Similar to the hoglin and piglin mobs, I wanted the ears to sort of "bob" to and from the head on the z-axis (rz) but I have no idea how to code it. I think I've narrowed down the issue a bit as it seems to be related to the sin function and the need to limit its range of motion. I tried using the clamp function preceding the code with the sin function but it still just spins all the way around in a circle and then spins in the opposite direction.
This is what I've come up with for the code so far: "ear1.rz": "clamp(sin(limb_swing * limb _speed) * 12.5 - 30, -30, -15)"
With this approach I was thinking that I could limit the rotation permaters of the sin function but I'm not sure if that's even possible, and obviously I didn't do it right. Another idea I had was that maybe there is a way to rotate the orientation of the sin function itself so that it is not straight up and down and would then swing in the angle I want but like I said I'm not really sure what do to.
I got super stuck, so the code above was figured out with some "help" from ChatGPT so if you look at it and realize it makes no sense that's probably why lol.
Any help would be much appreciated, I'm not looking for someone to code it for me (unless you just want to lol), but even if you could point me in the right direction that would be a tremendous help.
This is what I've come up with for the code so far: "ear1.rz": "clamp(sin(limb_swing * limb _speed) * 12.5 - 30, -30, -15)"
With this approach I was thinking that I could limit the rotation permaters of the sin function but I'm not sure if that's even possible, and obviously I didn't do it right. Another idea I had was that maybe there is a way to rotate the orientation of the sin function itself so that it is not straight up and down and would then swing in the angle I want but like I said I'm not really sure what do to.
I got super stuck, so the code above was figured out with some "help" from ChatGPT so if you look at it and realize it makes no sense that's probably why lol.
Any help would be much appreciated, I'm not looking for someone to code it for me (unless you just want to lol), but even if you could point me in the right direction that would be a tremendous help.
