How to make an Orbit around the Player, where the Position on the Orbit is controlled by the Cursor?

Hi im trying to make a sphere that has an orbit around the player, but the spheres position on the orbit is whereever its closest to the cursor.
I have a spline as the orbit around the player character, thats where the orbit reference is from.
I always get this error message :

Blueprint Runtime Error: “Accessed
None trying to read property
OrbitReference”. Blueprint: Drone
Function: Execute Ubergraph Drone
Graph: EventGraph Node:
SetActorLocation

I am new to Unreal, so im sorry if this is something really obvious, but this is my Blueprint so far:

The Project is the Basic Top Down Template, i only changed the movement to be WASD, and added a Dash.
If there is some Information missing, just ask.
Thank you in advance :slight_smile:

I always get this error message

Creating a variable does nothing on its own - it is not associated with any object. Imagine if you had 5 orbits and 5 drones - how is the engine supposed to know who is who…

You need to tell the orbit reference which orbit actor you mean. Are both the drone and the orbit in the Level Blueprint? If that’s the case, use the Instanced Editable reference to point it at the actor you need:

347188-screenshot-1.png

When i created the Variable, the Variable type is set to variable type to the spline object. Does that not tell the orbit reference which orbit i mean?

347201-bild-2021-08-24-205325.png

And neither are in the Level Blueprint.

When i created the Variable, the
Variable type is set to variable type
to the spline object. Does that not
tell the orbit reference which orbit i
mean?

Nope, sadly - what if you had 40 orbits? It’s a reference - it’s in the name, it has to refer to an instance of an orbit actor. Which orbit actor? Where is the actor?

If you create a string variable but forget to type in the text - what do you have? Nothing. Same with your Orbit variable - it’s null - hence the error accessed none.

And neither are in the Level
Blueprint.

So how do you spawn them, how do they get into the game? You flagged it as Instance Editable - so how do you edit that instance?


For dynamically spawned actors, you’d normally do something along the lines of:

347203-screenshot-1.png


So we have 3 elements here:

  • the player
  • the drone
  • the orbit

Sounds cool! But how do they come into play? They do not know about one another, right? What’s the relation? What should the relation be?

Perhaps the player owns the orbit and the drone follows it (and the cursor). Is that the scenario?

The Idea was that the Player owns the orbit and the drone is always on that orbit. They should all spawn together. The plan is that the drone is the players starting weapon.

Would you like me to suggest a setup for this or would you rather get help and try to fix the existing setup?

If it’s the latter, you’d need to explain in detail how the 3 actors come into play and who spawns whom.

Would you like me to suggest

Were I to approach what was explained above, I’d lean this way:

  • the Player has the spline (rotation should be flagged as Absolute)
  • the CAC creates the Drone actor (so you can replace it with another drone at a whim)

That’s what I understood, but you may have other gameplay plans so it may not be perfect.


I posted this recently:

Perhaps there’s something in there you can leverage. But you may have it covered, ofc. (seeing how your spline is already a neat circle unlike the monstrosity I’ve cobbled together)

They are all in the game from the start. So far im just trying how things work, so i just placed them in the world together, if that helps. Is that what you need to get this into working order or am i missing something?

347205-325.png

Thank you for going through this with me by the way :slight_smile:

I will try this, thank you!

so i just placed them in the world
together, if that helps.

So they are in the level (I said level blueprint - so that must have been confusing, my bad!). In that case you should be able to select the drone and choose which orbit actor it’s suppose to be using as in the green screenshot for above. But that’d still need connecting to the player…

Anyhow, if all three elements belong together, it’d would much simpler to ensure the player owns them from the get go, as below.

Awesome. Good luck with the rest!

It works perfectly now thank you so much! :smiley: