I'm working on a 2D side scrolling game, and I've run into an issue. Occasionally, when roblox physics happen strangely, the player is nudged, moving him on the Z-Axis, which, unfortunately, causes all sorts of issues with the game, as the player is unable to enter areas because of their location on the Z axis.

I'm hoping that there'd be some way to prevent a player from moving on the Z Axis entirely, and if he does manage to do that, teleport him back to a pre-defined point on the Z Axis.

If it's any help, you can see what I mean here at my place.

Thanks!

3 comments

0

Could you put an invisible block that prevents the player from moving into the Z axis?

0

If you really want to prevent movement along one axis, you can use a BodyPosition with its MaxForce set to a huge number at the axis you want to lock (all other axes being 0).

0

I'll try both of these and get back to this soon.