Locking a direction

Hi, first of all, My english is not the best…

I making a sidescrolling run&jump and want to lock the Y-direction so my playerunit ( in this case a ball ) not fall outside the level. The ball follow the ordinary Bullet physics in logicbrick. And I want it only move in Z and X, (up-down-left-right).

On the ball, add this logic setup:

Always --> And --> Constraints

In constraints, select “Y” and enter the grid value you would like it constrained to (to find this out, select the ball in the 3D window, then press [N]. The transform properties window will pop up, and the value locY will tell you what number your ball should travel along).

Let me know if you have any more questions.

Nice :slight_smile:

any way to prevent my player from rotating on its local Z axis?

I can make a 2d scroller if I solve this one problem :slight_smile:

Hey p00f! Haven’t seen you around in a while. I wondered if you had disappeared. :wink:

Well, I think it’s cool to see so much interest in 2D sidescrollers with 3D environments. I personally would like to make one myself in the near future. Of course, that means I’ve been thinking about all the ins and outs of it while I stack boxes at work, so I’ve got answers.

Here’s a simple solution: Give your character a Rot IPO on the Z-axis only. Set it at 0 degrees or whatever your desired rotation is. Now run it during gameplay with an IPO actuator. Never tried it, but it should work.

that is a great idea, I will have to try it. :slight_smile:

I have another solution as well… I just placed an empty at the end of my level and have the player Edit>Trackto>empty…

seems to work pretty well :slight_smile:

Yeah, that sounds like it works too. I personally want to make one of those games where your motion is constrained to a path in one direction like a 2D scroller, but were the path winds around (kind of like the Megaman game 3DGuru was showing examples from a while back if), so neither of those solutions will work for me. I think a long Loc IPO incremented with a Property would be the best way to do what I need…

thx, I´ll test it now…