never mind wasnt thinking one object pushing other and collision event two different things must have been a blonde moment [import]uid: 7911 topic_id: 17267 reply_id: 65267[/import]
… You’re lucky I haven’t been in the sun much the past few years and my hair is now light brown, otherwise those would be fighting words. [import]uid: 52491 topic_id: 17267 reply_id: 65367[/import]
I tested your code really quick today and I still have to play with it to see if it will integrate into my existing code. My issue with physics objects not colliding correctly in separate groups is related with me moving my display group using transition.to().
According to shane.lipscomb, if you modify the x or y coordinate values of your display group, it messes up the physics collision detection and I guess the collision occurs at the original x and y location and not the new location. I’ve seen this happen in my game through debugging and print statements. This really sucks because I need to move my display group towards the player.
For example, I’m making a parallax scrolling game where I have a bunch of coins stored in a group and the coins need to move towards the player. The player in my game cannot move forward or backward, but only up and down, similar to that game called JetPack Joyride. Because my player cannot move forward, I have to move the coins toward the player using transition.to().
By placing the coins in a group, the collision detection gets all messed up and it doesn’t work correctly. However, if the same coins are placed outside of a group and I move each coin individually, the physics collision detection works PERFECT. But now I’ve introduced a different issue to my game, by moving each coin individually across the screen, it causes a performance or stuttering issue with the fps. My coins have to go across the screen and once they get off the screen, then they have to reset their location back to the original location and later move across the screen again. The level is endless and the coins need to recursively keep coming towards the player at different time intervals.
Hopefully, this makes sense. Sorry for the long message.
[import]uid: 87837 topic_id: 17267 reply_id: 65551[/import]
I think the real issue with physics objects in separate display groups not detecting collision correctly is when the display group is moving. I believe if the display group is static and not moving, the collision should work. However, when you try to move a display group like my game example with the coins, the existing collision detection gets all messed up and it doesn’t work properly.
ok heres the problem you are having and what to do
when you insert the coins in the group there x,y values are alway in the same position the groups x,y is whats changing so if your player is at 240,160 and you transition.to the other group and a coin is at 10,160 in that group so the coin is always at 10,160 to correct this try using this http://developer.anscamobile.com/reference/index/objectlocaltocontent
Yes, you are correct. That’s probably what is breaking the existing physics collision detection when you place physics objects in groups.
I speculated that the resolution to my problem would be to create my own collision detection logic, however, I wanted to avoid that because I thought there already existed a solution for this problem. I guess your hitTest collision code is the solution jstrahan =)
Let me know when you update your code and I’ll test it in my game to verify that the collision works when you place objects in display groups that are moving. [import]uid: 87837 topic_id: 17267 reply_id: 65569[/import]
@peach
funny thing is if i had hair it would be dark brown/black so i had to go a long way just to get to that blonde moment [import]uid: 7911 topic_id: 17267 reply_id: 65595[/import]
Good news! Your latest code worked! I was able to get my coins to collide in a group which I never ever got working before. Good job jstrahan [import]uid: 87837 topic_id: 17267 reply_id: 65612[/import]