|
im wondering how would someone go about making a game where the screen constantly move lets say to the right whether your characters moves and not and where if ur character is standing on between a hard object and the left edge of the screen ur character would die or something. i think i know how i would be able to detect the edge of the screen but from there im not sure...
(comments are locked)
|
|
If your dealing with a perspective camera, check my answer here. A dirtier but maybe faster way would be to have 4 colliders on each side of the camera's frustrum to detect collisions (you'll need them to have a kinematic full constrained rigidbody). If it's orthographic, you can know the pos of each sides with the orthographic size and the aspect ratio (the next pos are relative to the cam) : right= (size * aspect, 0) left = -right, top = (0, size) bottom = -top. umm, it can help a bit but how would i know if the player is between the screen collider and an object(like a wall), an yes it is perspective. i got a bit of an idea like u said by having 4 colliders but not sure it would work
Mar 13 '12 at 07:12 PM
leonalchemist
You don't need (in that situation) to test if it is in-between. But once a collision occures, the player touched a wall and lost. Personally, I'd work with dot products and co though.
Mar 13 '12 at 07:30 PM
Berenger
i cant see one bit how it would work; i do have a bit of another idea but it doesnt seem very design friendly. thinking that if there's always a box collider on the left side of the screen and box colliders on the LEFT side of every wall then if my player collides with both of them then it means im located between those 2 colliders and lose a life or something. am i making sense or is this sounding like an idea for disaster? what u guys think?
Mar 24 '12 at 10:23 PM
leonalchemist
(comments are locked)
|
