Actor overlapping walls

rebzonerebzone Member Posts: 25
edited March 2012 in Working with GS (Mac)
Hi everyone,
I've got a weird issue and I really need a solution (I'm going mad): I'm using a main actor (a block with circle shape) which collides with walls (left and right) and ground. When the actor collides it completely stops without bouncing.
Now, when the actor collides with the right wall, it works perfectly, but when it collides with ground or left wall, it overlaps the ground/wall for 1 or 2 pixels...Everything is working, except for this overlapping issue...
Does anyone have an idea of what the problem is?

Thanks :)

Best Answer

  • rebzonerebzone Posts: 25
    Accepted Answer
    @tenrdrmer
    Thanks for your answer, but that's not the point: I need the main actor not to bounce, but completely stop when it collides...

    @everyone
    after days spent trying to resolve this "bug" (with the intense help of MotherHoose), I think this is exactly how GS is meant to work with collisions...Obviously that's just my opinion, but working with manual positioning always result in some sort of bug affecting other physics aspects.
    I definitely think that the 0,25 offset is used to let the collision shape work properly (as said before, +0,25 = rectangular shape, -0,25 = circular shape)...and that's all...
    As I said: just my 2 cents.

    Anyway, thanks everyone for your support...I hope this thread will help someone else fighting with this "bug" too :)

Answers

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Do you have an image for the walls or main actor?
    Try doing this without an image, just change the actor color and see if that works...
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Are your self.friction and self.restitution values the same for the left and right walls and ground?
  • rebzonerebzone Member Posts: 25
    @tatiang
    walls and ground are made with blocks 32x32...so, I have a single block I use to build walls and ground...So the answer is yes, friction and restitution values are absolutely the same (density=1, friction=3, restitution=0)

    @Braydon_SFX
    Yes, the main actor and the walls have an image...
    I tried what you said: using the same main actor without images (and still using images for the walls), it works correctly, but if I place the image/animation on it, the problem persists...
    The image is a 32x32 png made with photoshop (72dpi) ...any ideas? :((
  • calvin9403calvin9403 Member Posts: 3,186
    try to see if the actor's x - wall's x is the same as the size of the wall+actor half
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Not sure what it could be, then. You might have extra space on your images. (.png) which might make it seems like it isn't colliding correctly. You might want to look into that.
  • rebzonerebzone Member Posts: 25
    edited March 2012
    @calvin9403
    ummm...maybe that's the problem...
    The left wall is at 96 X, but when the main actor stops colliding with it, it's at 127,75 X (when it should stop at 128)...
    As I said before, I'm using the circular shape for collisions... Anyway, if I try to use rectangular collision shape, it stops at 128,25 X...
    The same for the ground and the right wall: there's always a 0,25 difference...
    But I still can't figure it out: as to answer @Braydon_SFX, I've re-checked all my graphics, and everything seems to be ok...

    I need to keep circular collision, because my game develops in a sort of checkerboard, where the main actor moves through paths of 32 width (using collisions). If I use the rectangular collision shape the corners of my obstacles stop my main actor.

    Is there something I'm missing about collisions? :-/
  • MotherHooseMotherHoose Member Posts: 2,456
    edited March 2012
    on wall/ground tile:
    Physics > increase density; increase friction; restitution=0; fixed rotation checked; and
    moveable unchecked … Collision Shape: Rectangle
    no collide behavior … nor rule's conditions overlap/collide

    on the circle:
    collide behavior
    Physics: only change the Collision Shape: Circle

    @};- MH
  • rebzonerebzone Member Posts: 25
    edited March 2012
    @MotherHoose

    still not working...
    I've changed density and friction to 1000 in the wall/ground actor and other parameters as you said. There's no rule inside.
    The main actor is circular, has the collide behavior, and I've changed the restitution to 0 to make it stop when it collides...
    I'm about to cry....
  • simo103simo103 Member, PRO Posts: 1,331
    @rebzone ... not sure if this will help but I remembered a forum post about placement of actors being off even if their X position was set. Wondering if that same issue is whats causing the weird overlap. IE the images are slightly off but the X value isn't thus the appearance of overlap. I'll link the forum thread below ... but wanted to suggest you move teh walls to a new position (to test) and see if you get a different result?

    http://forums.gamesalad.com/discussion/41040/problem-with-placing-actors/p1
  • simo103simo103 Member, PRO Posts: 1,331
    @rebzone .. if you can't fix the issue for real .. you may need to consider 'fixing' it by creating an image with a slight transparent edge for those overlay actors so it overlaps due to the apparent glitch but visually it appears to hit at the right time?
  • MotherHooseMotherHoose Member Posts: 2,456
    edited March 2012
    like both those post by you! … @simo103

    but, difficult to have tiled graphics lay in correctly

    are the circle and the walls on the same layer?

    mayhap using an invisible sensorActor … slightly larger than the tiledImage areas
    and have the circle collide with those sensors … would work???

    little bits/bytes for invisible actors …

    image MH
  • rebzonerebzone Member Posts: 25
    @simo103
    your first post seems to describe another problem I was having, since my walls and ground are built with 32x32 blocks... I resolved it just unchecking the movable flag in the block actor and everything went in the desired position (I think it was a MotherHoose hint, anyway ;)).

    Reading the full post, anyway, I don't understand if it's a GS creator bug, but it's resolved when building the game to iOS (I still can't try it, because I didn't subscribe as a developer yet), or if the bug still remains even on the iDevice...
    If someone could try it for me, I'd be glad to email my project, since this thing is driving me crazy ;)

    @MotherHoose
    the circle (which is not a circle, but a 32x32 block using the circle collision shape) is on the same layer of the walls.
    I don't think I can use a sensorActor, since I need to move in a checkerboard environment... I try to upload some images to better understand the scheme...

    https://dl-web.dropbox.com/get/Photos/bug1.png?w=c81d26ac
    https://dl-web.dropbox.com/get/Photos/bug2.png?w=cb4b966d
    https://dl-web.dropbox.com/get/Photos/bug3.png?w=d5dd7331
  • MotherHooseMotherHoose Member Posts: 2,456
    edited March 2012
    @rebzone
    leave everything as you have it
    make two absolutely transparent image.pngs
    one 512x512 … one 1280x800

    Publish with GS > select MacIntosh platform
    click through (dragging in those blank images when asked for)

    do Not publish to store! ;)

    and, you should get your app/game downloaded … so you can open it on your desktop!
    (and share with us for some testing!)

    for us to try your current-build gameApp … you would need an Ad Hoc provisioning profile from Apple

    happy that you are progressing so nicely! @rebzone

    @};- MH
  • rebzonerebzone Member Posts: 25
    @MotherHoose
    ...still, I'm about to cry :((

    ...Even building up the app doesn't resolve the bug, so, I really don't know what else I could try...
    The concept is so easy that shouldn't have any problem, but the bug is still there... I tried re-creating from scratch the game, but I still have the same issue...

    I'm about to give up: it's frustrating fighting with a bug I don't even know if it's something I made wrong or something related to GS itself :(

    I'll try creating something else...maybe...
    Thanks anyway all of you for your support :)
  • MotherHooseMotherHoose Member Posts: 2,456
    email to me @rebzone

    myname

    gmail

    perhaps I will cry with you!

    image MH
  • rebzonerebzone Member Posts: 25
    @MotherHoose

    You mean the app or the gameproj?
    Anyway I'm sending it this evening (now I'm at work :P)

    Thanks
  • rebzonerebzone Member Posts: 25
    @MotherHoose

    Nevermind, I just sent you the project ;)
    Thanks
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    @tatiang
    walls and ground are made with blocks 32x32...so, I have a single block I use to build walls and ground...So the answer is yes, friction and restitution values are absolutely the same (density=1, friction=3, restitution=0)
    Have not read the whole thread but this is prob your problem. You need some restitution to get a bounce. 1 is most likely more than enough but 2 is the highest you can go. try like .5 to start with and adjust it from there.
Sign In or Register to comment.