How do you dynamically scale collision object and/or dynamically remove part of a spine scene with script

Hi guys, I’m trying to further my game development education by completing a game every couple of weeks. Here’s the first snag I’ve run into on a prototype that I’m working on. I’ve got a projectile that the player fires, that can take damage and it gets smaller to represent the level of damage taken (the projectile’s “health” resets and the player can use it again if the player recollects it, see the vid to see what I mean). At the moment I just change the sprite every time to a smaller sprite when a projectile gets hit by a “danger” object. Is there a way to dynamically change the collision object to accommodate the smaller size of the projectile? The closest thread I’ve found to help with this was Scaling Collision Object when Game Object is scaled (DEF-521) but it’s got more of a work around in there, and it was posted over a year ago. Does anyone know if any progress has been made? Is there something more along the lines of go.set_scale_collision_object(“id”, vector3) now?

Also, I’m thinking about using a spine scene animation for the main character and when he throws out a chunk of feathers from his wings, which are the projectiles (yes, weird I know), part of his wings will disappear and his speed will slow down. Can I dynamically remove a part of a spine scene with a call like go.remove_spine_scene_piece(“id”, piece), which might require dynamic resizing of collision objects as well, or is it just easier to make multiple flip book animation sets with different sized wings and play them at the appropriate time? Cheers in advance.

You can dynamically scale collision objects by deleting them, and creating new copies with a factory with the scale set. Scale must be uniform. You can delete the go and then re-parent the newly created after you create it with a factory.

Why not make spine animations with the various attachments enabled / disabled? Or make the wings their own objects.

2 Likes

@Mathias_Westerdahl What happened to your exploration day experiment to enable scaling of collision objects? It seemed to be working when I saw the demo?

5 Likes

Well, I have it on a branch. It did indeed seem to work, but I think it requires some design by us to make sure it works reliably for our users. Also, native extensions sort of came in the way :wink:
But I agree that we should pick it up again to actually finish it.

6 Likes

Thanks for that

cheers

Thanks, look forward to it :+1: