How can I make a TwinStick Pawn orbit a Sphere?

Hi there guys,

I’m working on a project with some friends, and we are trying to create this:

  • The game is based on a spaceship that orbit a planet in the space.
  • It’s going to spawn asteroids and other ships that will attack in 360º this planet until it gets destroyed
  • The ship that orbits the planet need to rotate when the player press “A” Counterclockwise and “clockwise” when the player press “D”.

Here is a Sketch of what I need.

I’ll very grateful for anyhelp!

Make pawn physics based, for movement use physics thrusters only. Disable gravity. Then use physics constraint to hook pawn to center of sphere. I have prototype of game done like this, but all i can find are quite late backups they are too big and complicated to serve as example. I cannot find early build.

Nawrot, I’m quite new on the Unreal community. So I understand part of your answer. Can you show some blueprints ou something more simple?
PS: Thanks for the answer. ^^

That is the problem i lost blueprints of that game when it was still in simple form. Earliest backup of it i have is quite complicated, it will only confuse you. Anyway I will check once more later today.
Also we discontinued doing that game idea because limiting game area to just orbit of planet limits gameplay, it was just no fun at all.

There are multiple problems with gameplay on sphere, for eg: collision, shooting bullets, line trace for hitscan weapons, enemy AI (you need write it yourself from scratch), polar anomalies everywhere (about everything has potential danger for weird behavior around poles), you need to make everything physics based with constraints hooked to center. So in short a lot of battling against that polar coordinate system, without any real gain in gameplay and fun area.

Then some dillema we totally could not solve:

  • small planet that fits on screen looks gorgeous, but then you have tine gameplay area, bullets start to sirculate whole planet.
  • big planet means big game area, but then planet looks just like bent sheet, no point in making game areound planet anymore.

PS. and then we found this game: Super Stardust HD On the PS3 - YouTube

Here’s a couple of alternative ideas for simplified circular movement:

#1

Attach your ship to a Springarm, position it at the centre of the planet and rotate the Springarm - its length is the ship’s distance from the planet’s centre

[HR][/HR]
#2

  • Create a closed spline in a shape of a circle, an arc or an ellipse. You can do it manually in the editor or procedurally, the math is simple enough.
  • Position the spline at the centre
  • *GetLocationAtDistanceAlongSpline * and SetActorLocation(ship) - combining it with interpolation will result in smooth movement along the spline’s trajectory
  • You will need to include some rotation here as well for the ship, but that depends on your game concept

I saw the Vídeo, and it’s more complex than my students idea. We were thinking about a 2D movement, like the ship only travels clockwise and counterclockWise.
They starts to create this on Unity but they get stuck on the spawn of the asteroids and other ships. I convinced them to do it on Unreal, telling then that is much Simplier than Unity.

To be honest, I just need the ship to orbit the planet, not automatically but when the player holds “A” and while they do it or “d”.

At this point I’m felling so frustraded, because it seems to be so easy to do, but now I know that is more complex than I expect.

I have tried your First idea with no success, And I’ll try the second. THks

I mean, the 1st one is the most straightforward thing I can think of, the least flexible perhaps:

In motion:
https://i.gyazo.com/c80490f3fe583bd82e65eb8dcb06d33c.mp4

The controls should be set up better, of course; just an example.

This fits perfect in what I need. I’m setting the Pawn as default Now, because I was Using the Twin stick one and they don’t recognize this new as standart. Thank you very much for your help, both of you. ^^