26
« on: March 01, 2013, 02:06:08 PM »
Since I attempted it ages ago a couple more things have been added to cameras which might be helpful. Since basically nobody else has tried since I decided my old method didn't work, I'll say what I found in about 10min testing just now.
I maintain that the best way to do this would be the equivalent of the Smash TV player. Basically, playertypes have both a cameraVerticalOffset and cameraHorizontalOffset which work as intended, but only one cameraTilt which is vertical. The top-down player can use this to look downwards but there's no similar control for a 2D platformer side angle.
Using a camera's setOrbitMode on a player puts it at a variable distance away from you. (this is the spy camera)
Cameras can now control players e.g. the brick camera events. If in control of an orbit camera, and the camera controls you, the camera stays at whatever angle it was initially and you can move around. So you can at least have a view from the side, this still has 3D control though.
The view correctly adjusts to walls in its way. Since you're not directly controlling the player it shows your name tag.
In terms of automating this (put all players into platformer mode at the start), setOrbitMode appears to obey the minimum/maximum distance settings but whatever transform I set is ignored. The camera always appears on the north/south axis (-y of player) and is directly level with your body instead of from above like default third person.
For a Paper Mario-style view, that's all you need.
For a fixed 2D plane you need some way to stop players from turning or moving sideways, which is still difficult. Setting sideways move speed to zero partially works but holding W+A/D lets you move diagonally, not good. Uncertain how to stop them turning. For it to work well this has to avoid the "put players back in place/set rotation" schedule loop as that just causes lag, looks bad and probably fails if you turn/shoot etc. quickly.
The good news is that putting this together gets a view from the side that doesn't crash when you jump in water, so it's an improvement from my old one.