Collision and unmovable setting

clee2005clee2005 http://Donkeysoft.caMember, PRO Posts: 194
edited April 2014 in Working with GS (Mac)

I've just recently learned that the physics in GS has an exception when you have Movable unchecked (ie. unmovable object). That object will never fire a collision with another unmovable object. This sorta makes sense, except in the cases where you are spawning objects and are using the collision / overlaps rule in your logic. I'm wondering if anyone else has had problems with this or perhaps me writing this post will help others find something that messed me up for a bit.

@CodeWizard‌ do you think firing the overlaps event when an unmovable object overlaps with other unmovable object would screw things up for existing code? How long has that rule been in place? Was it just something for .11? It's something that I'm finding I could use more than in one scenario... detection when spawning dynamic objects for placement etc. Additionally, I think it's much clearer for GS users that the overlaps event fires when an object overlaps with the target object as the rule specifies, not with a hidden exception as it is currently.

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2014

    If you want to spawn actors - and detect collisions so you don't have two actors in the same place - but also want them to be immovable (by the way 'unmovable' generally means unaffected by emotion :) ) . . . . then I'd do it like this:

    Two objects, parent object (movable switched on), child object (movable switched off).

    Spawn a parent object.

    If it collides with a child object then destroy the parent object.

    If it lands in a clear space (no collision with child object) then the parent actor spawns a child actor (in the same position) and then destroys itself.

    Result, lots of immovable child objects without overlaps.

  • clee2005clee2005 http://Donkeysoft.caMember, PRO Posts: 194
    edited April 2014

    @Socks said:
    If you want to spawn actors - and detect collisions so you don't have two actors in the same place - but also want them to be immovable (by the way 'unmovable' generally means unaffected by emotion :) )

    Ha thanks @Socks I'd like to say that was a typo, but that was just wrong! Funny.

    As for your work around, thanks too. I do exactly that, but it's something I think shouldn't be necessary unless the physics engine is getting an enormous performance gain with this limitation (ie. no overlap event for immovable objects). My main point was that it's not an obvious exception and GS is all about being simple. So I would think others would find themselves confused with this inconsistency.

  • SocksSocks London, UK.Member Posts: 12,822

    @clee2005 said:
    Ha thanks @Socks I'd like to say that was a typo, but that was just wrong! Funny.

    I thought maybe you wanted your actors to be cold and emotionless : )

    @clee2005 said:
    As for your work around, thanks too. I do exactly that, but it's something I think shouldn't be necessary unless the physics engine is getting an enormous performance gain with this limitation (ie. no overlap event for immovable objects). My main point was that it's not an obvious exception and GS is all about being simple. So I would think others would find themselves confused with this inconsistency.

    Yep, I can imagine it's a subtly of the system that catches a lot of people out.

Sign In or Register to comment.