Ok, I am interested in creating a platformer game.
Now, I know that Unity can create 2d games, where my sprites are simply textures on planes etc and some help with Sprite Manager 2.
But I don't quite get it.
How do I check for collision between two planes? I mean... seriously...?
Naturally, there is gravity in my platformer game world. So objects like the player himself can fall.
If he hits a platform, won't his whole sprite suffer common collision effects like bouncing? Bouncing would cause the plane to, dunno, rotate or end up in a weird position, no?
Then my player runs... And hits a wall. Now there's another collision, the whole plane's Z position might increase and that means the player would fall to oblivion since all planes have 0 (or 1?) depth?
in the function update you can make the objects fix their xy position and rotation, making this objects to only work on XY planes
code like,
gameobjectX.transform.position = new vector3(gameobjectX.transform.position.x,gameobjectX.transform.position.y,0);
//and to correct the rotation on x and y correct those values to make it 0, meaning no rotation on those
if(gameobjectx.transform.eulerAngles.x != 0)
gameobjectX.transform.Rotate(new vector3(-gameobjectX.transform.eulerAngles.x,0,0);
if(gameobjectx.transform.eulerAngles.y != 0)
gameobjectX.transform.Rotate(new vector3(0,-gameobjectX.transform.eulerAngles.y,0);
with position the objects just move left right up down
and with the rotation the objects just rotate on the 0, 360 degrees you see from the front