#Can I play animation to an item when holding it?

1 messages · Page 1 of 1 (latest)

devout light
#

I created an add-on and I would like to know if I can play animation to a 3D item when I hold it. If it's possible, could you provide an example of the code and explain it to me? Thank you 🙏🙏

limpid marten
#

Is your animation meant to affect the player, the item only or both

wheat sedge
# devout light I created an add-on and I would like to know if I can play animation to a 3D ite...

Either use commands to add a tag to detect if it is being held using the hasitem command parameter "/tag @s[hasitem=]" then use script API to detect if a player has that tag and I recommend using {yourconst}.playAnimation as it can run client animations so you can affect third person or first person, another way is to use attachables or player.entity.json and use the query "query.get_equipped_item_name('main_hand') == 'your_item' " and make sure the 'your_item' only contains the word(s) on your item at the identifier after the " : " for ex.
po:3ditem my query would be, query.get_equipped_item_name('main_hand') == '3ditem'

#

And use v.is_first_person and
!v.is_first_person to detect first person and third person