Really weird situation...phantom collision object?!!

Hi,

I’ve been working on something now for the past few weeks and everything has been going reasonably well. Many times something won’t quite work as I intended or a bug will creep in and I’ll rectify it, the same as we all do when developing.

What has happened this time around is so strange that I’m finding it impossible to diagnose! I spend most of my time testing in the simulator and depending how far I’ve got I’ll test on my iPhone. I normally do this at the end of the day as I start to get tired to make sure all works okay on the device.

The latest update to my app works absolutely fine in the simulator but when I test it on my device I get phantom collision detection! When I first saw it I immediately assumed it must be an object that I didn’t remove or had just set its alpha to 0 so decided to turn on hybrid mode and add to my device again.

Here’s the thing, there is no object?! Even weirder is the object (a bomb) won’t always collide with this phantom object in the same place, it could happen anywhere on the screen, whenever it feels like it.

Now as I said this doesn’t happen at all in the simulator but only happens on the device. Has anyone else come across this phantom collision issue that could help me as I’m completely stuck now and have no idea how to resolve it.

I appreciate that my code maybe useful but there’s a LOT of it so I thought this might have happened before and someone may have a solution before I post an entire encyclopedia of code on here!!

[import]uid: 107915 topic_id: 35107 reply_id: 335107[/import]

Chris, curios what happens when your “bomb” collides with the phantom physics object.

Does if explode or does is just stop like hitting a wall.

I had something similar happen yesterday on a car trip.

My player was seeming to hit a wall or platform and stop moving. I’m using multitouch and was running when I tap jump and my player would just stop moving laterally. When it happened, I grabbed my Airbook and plugged in the device to see if I could capture an error in the Xcode console, but I couldn’t get the glitch to reproduce. I finally figured out the only time the glitch was happening was whey my device was plugged into my cheap Roswell inverter (modified square sine I think). For some reason when the device was plugged into and charging off the inverter, the glitch would happen regularily. I’m thinking multitouch was somehow not working correctly when plugged into the inverter. Still really don’t know the reason, only that when plugged into the inverter, weird things were happening with my players movement while everything else on the screen was fine.

Anyways, one thing you can do, if there is actually a “collision” happening, is to add a print statement in your collision function to see what bodies are colliding. I think collisions return “self” and “event.other”.

If you add a .ID to ALL your physics objects, you can easily see what object is colliding with your bomb if there actually is a collision.

Here’s an example:

bomb.ID = “BOMB”
player.ID = “Player”

print("self.ID == ", self.ID) --would probably print BOMB
pirnt("event.other.ID == ", event.other.ID) --would probably print the phantom object ID

Hope this helps,

Nai

[import]uid: 106779 topic_id: 35107 reply_id: 139581[/import]

Hey Nai, thanks for your response.

The bomb doesn’t explode as I have it on a timer and it bounces of the phantom object like it would any other object. The other strange thing is, every time the bomb hits an objects a sound is fired but no sound fires when it hits the phantom object!

I started to work on a sound issue I was having on a button press and put the above problem on the back burner so I could look at it with fresh eyes later on. About 2 hours later I went back to the issue and now can’t get it to collide with the phantom object! It’s as though it’s rectified itself which is good in one way but worrying in another way as I still don’t know why it was doing it. I’m not totally convinced it is fixed for good and I’ll probably come across it again at some point.

Thanks for the advice on adding an ID to my physics objects, if the problem does rear its head again, your advice will hopefully allow me to pinpoint the object my bomb is supposedly colliding with.

The users who eventually download our apps really have no idea whatsoever of what it takes to develop an app and the headaches we go through!! [import]uid: 107915 topic_id: 35107 reply_id: 139626[/import]

Chris, curios what happens when your “bomb” collides with the phantom physics object.

Does if explode or does is just stop like hitting a wall.

I had something similar happen yesterday on a car trip.

My player was seeming to hit a wall or platform and stop moving. I’m using multitouch and was running when I tap jump and my player would just stop moving laterally. When it happened, I grabbed my Airbook and plugged in the device to see if I could capture an error in the Xcode console, but I couldn’t get the glitch to reproduce. I finally figured out the only time the glitch was happening was whey my device was plugged into my cheap Roswell inverter (modified square sine I think). For some reason when the device was plugged into and charging off the inverter, the glitch would happen regularily. I’m thinking multitouch was somehow not working correctly when plugged into the inverter. Still really don’t know the reason, only that when plugged into the inverter, weird things were happening with my players movement while everything else on the screen was fine.

Anyways, one thing you can do, if there is actually a “collision” happening, is to add a print statement in your collision function to see what bodies are colliding. I think collisions return “self” and “event.other”.

If you add a .ID to ALL your physics objects, you can easily see what object is colliding with your bomb if there actually is a collision.

Here’s an example:

bomb.ID = “BOMB”
player.ID = “Player”

print("self.ID == ", self.ID) --would probably print BOMB
pirnt("event.other.ID == ", event.other.ID) --would probably print the phantom object ID

Hope this helps,

Nai

[import]uid: 106779 topic_id: 35107 reply_id: 139581[/import]

Hey Nai, thanks for your response.

The bomb doesn’t explode as I have it on a timer and it bounces of the phantom object like it would any other object. The other strange thing is, every time the bomb hits an objects a sound is fired but no sound fires when it hits the phantom object!

I started to work on a sound issue I was having on a button press and put the above problem on the back burner so I could look at it with fresh eyes later on. About 2 hours later I went back to the issue and now can’t get it to collide with the phantom object! It’s as though it’s rectified itself which is good in one way but worrying in another way as I still don’t know why it was doing it. I’m not totally convinced it is fixed for good and I’ll probably come across it again at some point.

Thanks for the advice on adding an ID to my physics objects, if the problem does rear its head again, your advice will hopefully allow me to pinpoint the object my bomb is supposedly colliding with.

The users who eventually download our apps really have no idea whatsoever of what it takes to develop an app and the headaches we go through!! [import]uid: 107915 topic_id: 35107 reply_id: 139626[/import]