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

**URL:** <https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [August 24, 2021, 5:02pm UTC](https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943 "2021-08-24T17:02:26Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Valaesztra](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/valaesztra/32/88707_2.png) [@Valaesztra](https://forums.unrealengine.com/u/Valaesztra)\
**Post date:** [August 24, 2021, 5:02pm UTC](https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943/1 "2021-08-24T17:02:26Z")

</div>

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:

 ![347178-unbenannt.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/8/5/a8590a92245153993350663361f77a060b4e5cf7.png)

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 🙂

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 24, 2021, 5:44pm UTC](https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943/2 "2021-08-24T17:44:41Z")

</div>

> 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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/0/f/00fe1e0206dcfd43b30cb7dbb4e6251289a8325d.png)

---

<div class="post-metadata">

**Author:** ![Valaesztra](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/valaesztra/32/88707_2.png) [@Valaesztra](https://forums.unrealengine.com/u/Valaesztra)\
**Post date:** [August 24, 2021, 6:53pm UTC](https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943/3 "2021-08-24T18:53:52Z")

</div>

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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/3/d/93d860bc7e8068c0566843f60e83fd16dbc9f350.png)

---

<div class="post-metadata">

**Author:** ![Valaesztra](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/valaesztra/32/88707_2.png) [@Valaesztra](https://forums.unrealengine.com/u/Valaesztra)\
**Post date:** [August 24, 2021, 6:55pm UTC](https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943/4 "2021-08-24T18:55:36Z")

</div>

And neither are in the Level Blueprint.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 24, 2021, 7:02pm UTC](https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943/5 "2021-08-24T19:02:17Z")

</div>

> 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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/1/e/41e39236be03a7bfc33649e2aa0144e60a29c2d7.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?

---

<div class="post-metadata">

**Author:** ![Valaesztra](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/valaesztra/32/88707_2.png) [@Valaesztra](https://forums.unrealengine.com/u/Valaesztra)\
**Post date:** [August 24, 2021, 7:35pm UTC](https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943/6 "2021-08-24T19:35:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 24, 2021, 7:40pm UTC](https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943/7 "2021-08-24T19:40:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 24, 2021, 7:52pm UTC](https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943/8 "2021-08-24T19:52:33Z")

</div>

> Would you like me to suggest

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

 ![347204-screenshot-2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/3/3/5336ae20b262f16d8a0d29d7c85e0b6902a4e261.jpeg)

- 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:

> [@Solar System Simulator/Generator](https://forums.unrealengine.com/t/solar-system-simulator-generator/62571/15):
>
> I lifted what was relevant from an old project (opening 4.17 → 4.27 is no fun at all! wink but still pretty stunned it actually opens & works almost out of the box!): Project link: Here’s what this actor can do: Some basic controls for this are exposed but it needs a ton of features to make it useable / more flexible. I’d start with adding controls for how many SMCs are needed for smaller / larger orbits - currently it’s a fixed number. May be fine depending on what this is going to be u…

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)

---

<div class="post-metadata">

**Author:** ![Valaesztra](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/valaesztra/32/88707_2.png) [@Valaesztra](https://forums.unrealengine.com/u/Valaesztra)\
**Post date:** [August 24, 2021, 7:56pm UTC](https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943/9 "2021-08-24T19:56:52Z")

</div>

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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/3/0/b30f50221d8bd44d703ff06de85d180b005888a0.png)

Thank you for going through this with me by the way 🙂

---

<div class="post-metadata">

**Author:** ![Valaesztra](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/valaesztra/32/88707_2.png) [@Valaesztra](https://forums.unrealengine.com/u/Valaesztra)\
**Post date:** [August 24, 2021, 8:03pm UTC](https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943/10 "2021-08-24T20:03:58Z")

</div>

I will try this, thank you!

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 24, 2021, 8:22pm UTC](https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943/11 "2021-08-24T20:22:13Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![Valaesztra](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/valaesztra/32/88707_2.png) [@Valaesztra](https://forums.unrealengine.com/u/Valaesztra)\
**Post date:** [August 25, 2021, 12:31am UTC](https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943/12 "2021-08-25T00:31:21Z")

</div>

It works perfectly now thank you so much! 😃

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 25, 2021, 5:18am UTC](https://forums.unrealengine.com/t/how-to-make-an-orbit-around-the-player-where-the-position-on-the-orbit-is-controlled-by-the-cursor/487943/13 "2021-08-25T05:18:41Z")

</div>

Awesome. Good luck with the rest!
