Collision problem when using constrain attribute to take player in and out of scene
I am facing a collision problem. To avoid the spawn and destroy method I am putting my player out of the scene. Now it is supposed to be colliding with invisible ground and walls inside the scene.
Problem is once it gets destroyed, (simply constraining position out of scene) and as the player is coded with the camera, due to the collison with the walls, it is not able to come back inside the scene, the camera shifts outside the scene to focus on the player. Player spawns and falls out to oblivion as there is no ground outside the scene of 1024.
Can any one suggest how to avoid this problem?
Problem is once it gets destroyed, (simply constraining position out of scene) and as the player is coded with the camera, due to the collison with the walls, it is not able to come back inside the scene, the camera shifts outside the scene to focus on the player. Player spawns and falls out to oblivion as there is no ground outside the scene of 1024.
Can any one suggest how to avoid this problem?
Comments
1) put some ground and walls way out there so that the player is contained inside something
2) or constrain the players x,y position _only_ when its x is outside the scene boundaries
To keep the camera in bounds, use another (different) actor to control the camera. Here is an interesting thread that may shed some light on camera use:
http://forums.gamesalad.com/discussion/40538/camera-working-with-multiple-characters