Physics and drop-shadows in gfx

I have block objects that have some drop shadow, and I want to allow for bouncing off of these, but I don't want the drop-shadow factored into the physics shape size. What options do I have besides removing my drop-shadow? I suppose I could split the drop shadow into a separate graphic, but that would be a good bit of work. It would be ok (far from ideal) for the non-movable objects, but the movable objects that have drop-shadows as well, but would be a bit more work. Can the physics shape have a size defined for it? Ideas?

Comments

  • adambowker98adambowker98 Member Posts: 57
    You could simply spilt the graphics and constrain the shadow's position to the actor's position plus/minus a few pixels to position it correctly.
  • sabshiresabshire Member Posts: 15
    Yeah, I may just redo the graphics to be more flat. It would be a nice feature to be able to adjust the physics shape size. In theory, it should be a simple thing to implement. Right now, it's just using the Actor size. It would only have to use a different property when the shape is created.

    GameSalad uses Box2d, right? I know this is a simple thing to do with Chipmunk, and I assume it would be trivial in Box2 as well, since the physics shapes are completely separate from the actual graphics.
  • SparkyidrSparkyidr Member Posts: 2,033
    Custom collision shapes is something some of us have been asking for since the dawn of time here. Not sure if they are on the current roadmap (or if its something that needs to be added with the "new engine" when that happens)
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2013

    Hi @sabshire I did shadow test for someone a while back, don't know if it'll be some help/relevant for you.

    The only thing about shadows is when they move over non-horizontal surfaces; there's no built-in physics to cope with that in GSC as you know, and would be a fair bit of work to get right, I'm thinking...

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2013

    Hi @sabshire I did shadow test for someone a while back, don't know if it'll be some help/relevant for you.
    As an object approaches the source of light (in this case the sun?) its cast shadow grows rather than shrinks.

    image
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2013

    Hi @sabshire I did shadow test for someone a while back, don't know if it'll be some help/relevant for you.
    As an object approaches the source of light (in this case the sun?) its cast shadow grows rather than shrinks.
    OK, thanks. Wouldn't take much to amend the game file. :-)

    @sabshire Also, I seem to remember, the processing of size "slips" the longer it goes on, the shadow getting larger and larger, so if the file was of help, you'd just need to change attribute the size for when it changes direction; should be fine then.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • glyniusglynius Member Posts: 231

    Hi @sabshire I did shadow test for someone a while back, don't know if it'll be some help/relevant for you.
    As an object approaches the source of light (in this case the sun?) its cast shadow grows rather than shrinks.

    image
    it is like this. i would suggest also to fade it out and blur it as it reaches height.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2013

    Hi @glynius For the record, my test file does do that, (fade at least, unlike the example shown above) even though the size increase/decrease is the wrong way round..... ;-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • glyniusglynius Member Posts: 231
    Hi @gyroscope, i haven't checked your test file, i just saw the video...and on this video i think that the increase-decrease is correct. Normally when an object is far from the floor, the shadow is bigger, blurrier and less opaque.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2013

    Thanks for confirmation, @glynius , appreciated. :-) If the test file is helpful for @sabshire it won't take much to correct that, for sure, as you know. (I haven't got time at the moment.... I'm finishing up one of my "mini"-apps, ready soon.... I'm actually getting my act together..... ;-) )

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • sabshiresabshire Member Posts: 15
    I've not looked at the sample yet, but I think it might be a bit more than what I was looking to achieve.

    In my scenario, I basically just have a drop-shadow around a block or a ball, meaning the object looks slightly raised off of the surface. The shadow of course increases the dimensions of the object, and so the physics takes that size into account, and collides before the actual part of the object (the block, ball, whatever) actually collides with the other object.

    So assume I have a 64x64 block. And assume the shadow extends out 4 pixels on the x and y, that would make the dimensions 68x68 when in fact the block only takes up 64x64.

    Make more sense? What you have presented is pretty cool though, and definitely something I want to take a look at, but I am not sure that it will be useful for me.
  • sabshiresabshire Member Posts: 15
    So I think that what I am going to do is just recreate the graphics minus the drop-shadows. For the game I am working on, it should be fine, in fact it may end up looking better anyways. But custom collision shapes would be a relatively easy thing to implement, and would really increase the flexibility of the gamesalad engine.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi @sabshire thanks for more explanation, I see what you're after now. So you can constrain the shadow graphic with the main actor, using constrain attributes for x and y. This will preserve the collision perimeter on the main actor as you want.

    But then it sounds like you're not going to add a shadow now; either way, best of luck! :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • sabshiresabshire Member Posts: 15
    @gyroscope, if I decide I don't like the look without shadows, I'll use that trick. Thanks!
Sign In or Register to comment.