Collision between content and transitioned object?

I’m having this issue and I can’t get it right. I suspect it has something to do with local coordinates Vs content coordinates. But I’m not sure. I’ve experimented with the “object:localToContent()” function but it doesn’t seem to solve the issue.

Bellow are two images explaining the problem.

I have:

  • The display/content area (red lines)

  • A group (blue area)

  • Objects (green boxes)

The boxes are added to the screen and given physics properties. They fall and land on the bottom of the content or on another green box. When a green box collide with the bottom or with another green box it is added to the group (blue area). If I transition the group downwards, say the height of two boxes, the coordinates of the top most box are not “updated”. The next falling box will think that the top most box in the group is located where the box with the green line is, the “Actual Y pos”, when it should “know” that the top most box in the group is at the “Real Y pos”.

How do you solve this?


[import]uid: 41041 topic_id: 11185 reply_id: 311185[/import]

Anyone?

Just to simplify my question: How do you make the falling block that is inserted into content (stage) collide with the blocks in the group if the group has been transitioned say 200px on the Y-axel? [import]uid: 41041 topic_id: 11185 reply_id: 41151[/import]

*bump*

Someone must know how to solve this, right? [import]uid: 41041 topic_id: 11185 reply_id: 42597[/import]

Just guessing here – sounds like when you do a transition the internal physics “pointers” don’t get updated since the physics engine didn’t actually move things.

Instead of moving the stack of blocks with a transition could you set the “ground” they’re sitting on lower and let the blocks fall down to that level? That way the physics engine is actually involved in moving the blocks.

Like I said before, I’m just guessing at what might be happening / what might work. :slight_smile:

Jay
[import]uid: 9440 topic_id: 11185 reply_id: 42598[/import]

if you are moving platform and if you holding the reference to boxes in some sort of table, I think best solution is to translate all the boxes programmatically when you moving your view. [import]uid: 48521 topic_id: 11185 reply_id: 42607[/import]

Also I have strong hunch, that your objects aren’t in same display group, which is leading to this problem that you are facing. [import]uid: 48521 topic_id: 11185 reply_id: 42610[/import]

Thanks for your responses guys. It’s correct that the objects are not in the same group (they are added to one group after collision) and have to stay that way. I will experiment a little with based on your comments and see what I can come up with. [import]uid: 41041 topic_id: 11185 reply_id: 42613[/import]

If you are using displaygroup from purely container perspective, you are better of using just table as container and handle movement of the “group” of object, yourself. [import]uid: 48521 topic_id: 11185 reply_id: 42614[/import]

I think I did that from the beginning but couldn’t get the height (combined height of all the stacked objects) of the table as I can with the group. Can you get the height of a table? [import]uid: 41041 topic_id: 11185 reply_id: 42626[/import]

why do you need height to translate? (just curious)
Anyways, I think you can easily keep track of height in your program. In your collision handler for the dropping box and stack of boxes, you just keep a variable which gets incremented by the box that just got dropped… [import]uid: 48521 topic_id: 11185 reply_id: 42628[/import]

The tracking of the height is for other logical functions that I will need later on. If the boxes fall off the stack but doesn’t fall off the “platform” they are still in the group but does not add to the height. So that’s why I can’t just increment by the height of the box. [import]uid: 41041 topic_id: 11185 reply_id: 42630[/import]

So no way of getting list of only “stacked” boxes at any given point? [import]uid: 48521 topic_id: 11185 reply_id: 42631[/import]

hmm, no I don’t think that is a valid option. However I can try and experiment with it a little bit just to see what I can do. [import]uid: 41041 topic_id: 11185 reply_id: 42632[/import]