I'm a newbie working on a 2.5D game, and I've run into a bit of a problem with the character movement when it comes to UP and DOWN controls that handle depth.
The objects in this game are in a 2D top down world space, and in rendering they are put into a walking area with a front to back perspective transformation. Mainly I'd like to scale them appropriately as they walk towards or further from the screen/camera. This is then all put over top a 2D background. The issue is that the strictly up and down movement in the world coordinates is going to render showing them following along the imaginary perspective lines. Meaning that at any point off the center of the screen, UP/DOWN becomes a diagonal movement that gets wider the further off center the player is. This makes for some really wonky controls that are hard to navigate.
I've attached an image depicting the problem, and what I would prefer to achieve.
I'd like the movement to actually just go up and down, but maintain their world position accurately for collision detection.
There were a few thoughts that I had, and I was wondering if someone with more experience could tell me if I'm headed in the right direction.
My first idea, a not very ideal one, was to split the physics and rendering on the X axis. The rendering would not scale the X into perspective, but the scaling amount would be captured in the physics and scale movement speeds and collision width. Creating a strange distorted physics world, but rendering the way I'd like. I've done this one part way and so far seems to work, but I worry about collision detection.
Now I'm wondering that maybe it's sensible to apply some sort of transformation to their movement force vectors, so they will orient to a path in world space that will create the desired results in rendering.
Last was that perhaps there is some other method of projection I'm not yet aware of that will get me the sprite scaling effects without the movement side effect.
No comments:
Post a Comment