Physics and drop-shadows in gfx
sabshire
Member Posts: 15
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
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.
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
@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
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
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
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.
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