Game Development Community

Can two objects from different scenes collide.

by Johnny Vo · in iTorque 2D · 08/23/2010 (6:08 am) · 4 replies

Can two objects from different scenes collide? I tried it and couldn't get them to collide using the onCollision method. I was hoping maybe someone could prove me wrong.

Thanks!

#1
08/23/2010 (8:33 am)
When you say different scenes, you me different levels? If that's what you mean, I think it depends on how you manage your scenes. In my case at the end of a scene I clear all objects, so that in the next scene the previous scene objects are not present. So in my case, obsolutely not, objects only exist per-scene. But, it you don't clear the previous scene objects then I guess they will still be there, although I don't understand why you would want to do that.

Weird question, I think you will need to elaborate a bit.
#2
08/23/2010 (8:37 am)
Sorry I was kinda vague. There's the default scenewindow2d. I made another one right on top of it. Now I have objects on both of them, but I want them to collide. Thanks for asking.
#3
08/23/2010 (11:45 pm)
Ok I see what you mean, two different scene windows in the same level, right? I've never tried that, but I'm guessing that objects can only collide with other objects that exist in the collision layers of one scene window. Collision layers are defined per scene window, so I don't think there will be any connection between different scenes. I could be wrong, but that would be my guess.
#4
08/23/2010 (11:46 pm)
I think you are right. Anyway, I'll try a different approach. Thanks!