|Topic was automatically imported from the old Question2Answer platform.
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 ?
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.
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!
Di_Pasch | 2019-03-19 12:39
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!
Di_Pasch | 2019-03-19 14:01