Hey guys,
So I’ve been following a lot of beginner tutorials for learning Unity and they are fun projects but I would like to move onto my own project using what I have learnt as insperation, but I am kinda stuff on the best method for approaching the new project and would like to assistance on the matter.
Please allow me to explain.
Sorry about the crude drawing. My drawing skills arn’t really up to scratch.
Okay, so my idea is that you create a circular platform which allows the user to be able to press and hold down the left or right arrow key. Pressing the left arrow key would allow the ball to roll around on the top of the platform and pressing right would causing it to roll vice versa. The camera is locked and always faces the ball. Pretty simple I think. I’m hoping to expand this and maybe add some platforms to jump over. Please help me get started with this simple project.
From Cubies. <3
Which part exactly do you have problems with?
Making the ball roll around the top of the surface in a circular direction so it doesn’t fall off the platform.
Assuming you’re using a script similar to that from the Roll-A-Ball tutorial, what I would do is each frame, before you adjust the ball’s position, re-orient the ball to face the center of the platform. I guess you’d also want to disable forward/backward movement then as well, to stay along the same line.
Try looking into that and playing around, and if you run into problems, post code (formatted with code tags!) and error messages, and we’ll get you sorted out.
For a native solution you could just model a chanel and let the physics system do the work for you.
I’ve thought about adding bumpers to keep the ball rolling around the platform as a short term solution, but what happens when the user makes the ball jump into the air to avoid obstacles or to reach collectables?
One solution I’ve been looking into is always making the ball stay a fixed location from a central point. Whereby the ball is allowed to move left and right but can never more closer to or further away from a fixed location.
A joint to keep the ball a fixed distance from the centre might work.
If you get to a point where your stuck with your script just post it here and let us know what your stuck on. you could probably set up the camera in a 3rd person style that follows the ball, or do a fixed camera like @Kiwasi suggested