3D side scroller

I have been working on a side scroller for a while and I have 2 questions

  1. I have a character that can walk right and left while facing the same direction but I want him to face the direction he is walking it so… What is the easiest way to set it up so that when I move right my char moves right facing that way and when my character moves left he is facing that way.

  2. My character can only move left or right in the -X- axis, however sometimes he slides/falls off the ground because it is uneven, is there a way I can constrain him so he isn’t able to move in the -Y- direction at all.

Thanks

on the gamelogic buttons, set it to a rigid body, then in the ‘advanced’ popup, uncheck the directions you don’t want it to move/turn.

well I have my char parented to armature which, both of them are set to No collision, and they are parented to a box which is Dynamic, so do I change my char or my armature or my box to rigid body?

the box seems to do all the physics in your case, so you have to restrain its movement, not the empties or the models…#

about the model turning left/ right:
I could imagine that you would have a keyboard sensor in pulse mode that does the x-movement. Try add 2 other keysensors in single pulse mode (one for walking left, one for walking right; both same as x-movment above) that do the direction turning.
Should work :wink:

actually it’s a litte bit more complicated, I did an example .blend. Just used logic bricks and used an ipo for turning as well as a string property to check the direction of walking.

Attachments

turning.blend (127 KB)

Thank you very much Zapman I was able to figure out how to turn him left/right, it was kind of vexing since adding just a couple of things makes the physic blocks so convoluted, I have yet to try out the constraint but Ill do that later on tonight, thanks again.

I tryed setting the box to rigid body and when I try to restrain its movement, it still moves slightly in the -y- position whenever he turns from left to right or vice versa, and eventually falls off.

ty i have had the same problems X3

I think a much simpler solution for facing the right (err…correct) direction would be to use two empties parented to the character (or physics box or whatever is necessary), one on each side. When the key for moving right is pressed, the character tracks to the empty on the right and moves forward.
Then do the same thing for the left.