'allo, I’m trying to develop a complex system for controlling a character, which will incorporate several different gameplay styles into one. Needless to say, it’s kinda tough.
Basically, imagine a Sonic the Hedgehog sort of game; a camera that can rotate around the character, and controls that allow the character to run along walls and ceilings. Because the character can rotate so much, the camera will rotate to follow the character’s orientation.
This is based on three main stats; MaxSpeed, acceleration, and traction. MaxSpeed determines the fastest running speed he can reach on his own acceleration power. Acceleration is, of course, the rate of acceleration (different for each character).
Traction is a force that holds a character to the ground based on his current running speed. Traction also reduces the effect of gravity on the character and “rights” the character to the surface he’s running on.
A traction of 0 will mean that the character cannot adapt to the ground he’s running on, and can’t defy gravity at any speed.
A traction of 100 will let the character freely stand on any surface he’s on, even if he’s completely still. (though if he jumps into the air, he’ll fall like normal)
My basic idea is this. Feel free to ignore this if you already have an idea:
-If the player is grounded,
-Get joystick input.
-Translate the joystick’s input to the direction the camera is facing. (X=camera’s x, Y=camera’s z).
(Basically, Y is “forward”, based on the direction the camera is facing, and X is “sideways”.)
-Translate the input based on the character’s orientation. (X first, then Z, so the rotation stays relative to the camera). (So the character will naturally move across the surface based on the shape of the surface he’s on.)
-Apply force to the character based on how much he’s accelerated. Apply force in character’s “down” direction based on said speed and “traction” stat.
At this point though, my lack of neurotransmitters is getting to me, and I haven’t the slightest idea how to go on.
Might anybody have any suggestions on how to account for resistance against running speed? For instance, if the character runs into a wall, his running speed might drop to 0, but the surface he’s running on might affect any reference to his absolute speed.
Or any suggestions for anything else, in case you think I’ve completely screwed up with this.
Thanks.