0 votes

Hello!

My team and I decided to use Godot for a school project.

We are thinking of making a very simple 3D platformer / sidescroller, our player would be able to move only along the X and Y axis however I was unable to find a way to restrict our player's movement in such a way.

Ideally, we would also like to prevent collisions from displacing our player outside of the set path, in other words the player's position on the Z axis would need to stay constant throughout the entire game even when hit by enemies.

I read that in Unity, you could use a SplinePath for this sort of things.

Is there a way to make something similar in Godot ?

Many thanks!

in Engine by (17 points)

1 Answer

+1 vote

Hello! Great to hear.
There are a couple different ways to do this, but if you decide to create this in a 3d scene (instead of 2d with rendered 3d elements) there is the axis lock settings in the Inspector to lock the z axis for any 3d object.

Could you expand how you mean for the players set path to work?
But CollisionShapes can just be disabled if needed, and now since 2.1 you even animate that setting while animating the position.

by (911 points)

Hello, thanks for the quick reply!

I may not have explained myself very clearly, basically we only want the player to move around in the X and Y axis only in a 3D environment

Your suggestion seems to be the way to to, I'll give it a try asap!

Hello Again!

I seem to be running into a bit of an issue.

I set up a ball as a test but I did it using a KinematicBody, however the lock axis option is only available when using a RigidBody.

Should I work my way around and make a RigidBody instead, or is there a way to make this work with my existing KinematicBody?

Many thanks again!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.