Unexpected collision on device (work fine on simulator)

Hi ,

I’m trying to achieve a one side platform where if you hit some object on the left side you loose otherwise you go through, but I got a weird bug.

Everything works fine on simulator but on device sometimes the player does not go through the platform and hit the platform from the bottom while it should go through.

I can’t understand, someone have idea where that could come from ?

I can put some code if needed.

thanks 

Hi Julio,

Is this an issue that you reported a few months ago, and we attempted to work through, or is this a new issue?

In regards to differences between the Simulator and devices, my first suggestion is that you run/test the game in “hybrid” physics mode so you can see how the physics engine is regarding the object bodies. If there is some difference between Simulator and device, then you can attempt to find the reason why in your code.

Best regards,

Brent

Hi brent,

No this is an other issue, by the way I forgot to lock the other topic sorry for that, I’ll do it today.

Everything was worked fine until I try to handle my game for old device and now depending on the device the collision work differently…

i’m running the game in hybrid on device and simulator and the physics look right on both of them, I think it’s about the condition, the config.lua and the way is scaling the world, but not sure … I thought it’s was due to my camera but even when I disable it, I got the physic problem

The physics engine give me a lot of headhache, I’m missing something ^^ 

My workflow is the following:

  • preloading all platform tiled like that

  • loading Platforms tiled and assembled them and adding Physics when needed

  • Finally handling preCollision and Collision for the player

EDIT : I removed  the huge code I have posted to simply the reading because it was unnecessary, I can put back some if someone need it.

So until here I don’t know what I’m doing wrong, I have just a doubt about the +8 you use on the precollision from the physics contact sample, I guessed it was event.other.height/8 and it was here to avoid some collision problem…

Can you enlighten me a bit if I’m wrong somewhere, I know it’s hard to say like that, but I’m stuck, because I don’t know where it could come from because in the simulator on every device you have implement to test it’s working fine …

if you need more detail, I will give you them with pleasure.

 thanks a lot in advance :slight_smile:

Hi Julio,

This might not be a code issue, since it seems to work differently on different devices. What is the “scale” setting that you’re using in your config.lua file? Are you doing any other scale operations (:scale(), .xScale, .yScale, etc.) on any objects or groups involved in the physics interactions?

Brent

Hi brent,

Ok I fix it using a filter collision, the bug was about a physics object on my player whom should not interact with the platform, the object.id was not involded in the collision condition and it was sensor, so it should has to always gone through the platform  but it has created some bug with the collision of my “player foot”,  maybe without filter it has interacted with the world and my" player foot" and make the collision problem I had, I don’t really know ^^

Now everything, even my camera and some object I’m scaling work :wink:

thanks again for you help brent

see you

Hi Julio,

Is this an issue that you reported a few months ago, and we attempted to work through, or is this a new issue?

In regards to differences between the Simulator and devices, my first suggestion is that you run/test the game in “hybrid” physics mode so you can see how the physics engine is regarding the object bodies. If there is some difference between Simulator and device, then you can attempt to find the reason why in your code.

Best regards,

Brent

Hi brent,

No this is an other issue, by the way I forgot to lock the other topic sorry for that, I’ll do it today.

Everything was worked fine until I try to handle my game for old device and now depending on the device the collision work differently…

i’m running the game in hybrid on device and simulator and the physics look right on both of them, I think it’s about the condition, the config.lua and the way is scaling the world, but not sure … I thought it’s was due to my camera but even when I disable it, I got the physic problem

The physics engine give me a lot of headhache, I’m missing something ^^ 

My workflow is the following:

  • preloading all platform tiled like that

  • loading Platforms tiled and assembled them and adding Physics when needed

  • Finally handling preCollision and Collision for the player

EDIT : I removed  the huge code I have posted to simply the reading because it was unnecessary, I can put back some if someone need it.

So until here I don’t know what I’m doing wrong, I have just a doubt about the +8 you use on the precollision from the physics contact sample, I guessed it was event.other.height/8 and it was here to avoid some collision problem…

Can you enlighten me a bit if I’m wrong somewhere, I know it’s hard to say like that, but I’m stuck, because I don’t know where it could come from because in the simulator on every device you have implement to test it’s working fine …

if you need more detail, I will give you them with pleasure.

 thanks a lot in advance :slight_smile:

Hi Julio,

This might not be a code issue, since it seems to work differently on different devices. What is the “scale” setting that you’re using in your config.lua file? Are you doing any other scale operations (:scale(), .xScale, .yScale, etc.) on any objects or groups involved in the physics interactions?

Brent

Hi brent,

Ok I fix it using a filter collision, the bug was about a physics object on my player whom should not interact with the platform, the object.id was not involded in the collision condition and it was sensor, so it should has to always gone through the platform  but it has created some bug with the collision of my “player foot”,  maybe without filter it has interacted with the world and my" player foot" and make the collision problem I had, I don’t really know ^^

Now everything, even my camera and some object I’m scaling work :wink:

thanks again for you help brent

see you