Rive animations + collisions activation


What would be the best way to integrate animations from Rive + activating proper collision shapes serving as areas where weapon is for a purpose of a fighting game (or any game with fighting)?

Few ideas that come to my mind is to set up a “key frames” of collision that I will activate manually in code during the animation (preferably then split animation in Rive into parts) or somehow utilise Rive state machines for this (or it’s a bad idea, because there might be multiple short, queued states like “attack1_frame1”, “attack1_frame2”, etc…) - what are your ideas?

Or maybe somehow attach collisionobject with shape to bones in rivemodel?


I’m curious about the best workflow for this as well. Did you come up with a good way to do this?

Not yet. Because of some problems with different projection in Rive renderer and different in game, I can’t set Rive models yet at the position of the game object in world, hence I’m waiting for resolving this before I will go with anything related to collisions, but I will most probably go with attaching collision objects to the bones (aka game objects). I will share the details when completed :wink:

I think Create Go Bones have to be true in .rivemodel properties. Then I would get particular bone (game object):

local left_hand = rive.get_go("#rivemodel", "Left hand")

And attach another game object with needed collisionobject component as a child to this game object.