[Q] Change Collision shape during gameplay?

I was wondering if it is possible, or if there is a work around to change the collision shape from square to circle and so on.
At least i couldn't get it to work properly because i'm now spawning another actor with a different collision shape that replaces the other actor. But if you do that it doesn't constrain the velocity's.

I really hope someone can help me out. Thanks!

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited October 2013
    I don't think you are able to change the collision shape at runtime. But maybe what you could do is use a set of 3 actors. The main, visible actor, would not have any collision shape then you could constrain one of the two other actors to its position. Each of the other two actors would have either a circular or rectangular collision box but the main actor would have an alpha of 0. Then use those actors to control the collisions.

    It's certainly more work and really just a work around, but it would probably do the job.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    One idea is to have two actors with identical rules, one with a circle collision shape and one with a square collision shape and then swap them out (spawn and destroy). You can capture the first actor's velocity by storing it in a game attribute and then just have the other actor change it's own velocity to the game attribute when it spawns.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.