Animated collision shapes
GrimmGhosts
Member, PRO Posts: 33
I am familiar with custom collision shapes but I do not know if there is a way that I could make an animated character with different custom collision shapes cycling with the animation. The animation is just a bat flying, not player controlled.
Comments
I found the tutorial about animation custom shape from Gamesalad Guru
I didn’t watch the videos because it’s not what I need right now but it would help you. The author is a very well known and high skilled GS developer.
My Gamesalad Games On App Store:
Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1
Collision shapes are actor-specific, not image-specific. Because of this, I don't think there's any built-in way you can use different custom collisions for a single actor.
One thing I can think of -- and it's not terribly efficient -- is to destroy the actor and spawn an actor with the next frame's image. And repeat as needed for the full animation. Each actor (frame) would have its own custom collision shape.
And watching through a bit of the video series above (there are several parts to that tutorial FYI, that's just part 1), it looks like that's the way @The_Gamesalad_Guru does it.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I did a few tests to see if I could get this functionality to work; @tatiang is correct in stating that you can't use multiple collision shapes for a single actor, and each frame would need its own actor with the associated collision shape.
Here's an example I made of an animated rotating 3d cube using this method: https://drive.google.com/open?id=1SMTM40j9LLX0F4D5Wi9LwHecmKw8Vxhy
I found no lag back when I did it but that was many versions ago. I was surprised how efficient it was.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
If its just a bat flying there is no point in adding custom collision shape that matches every frame, a collision circle or square would be fine. You will just add unnecessary computation to your game that you can avoid. I dont think other games do it that way either.