0

I am currently trying to simulate a solar system in unreal engine using blueprints. In order to calculate the force with which the actor (eg moon) should move, I need to know the mass of the parent actor (eg earth).

I am having issues trying to achieve this though, since I am quite new to Unreal. When I run my script, I am getting an error:

Blueprint Runtime Error: "Accessed None trying to read Class from property CallFunc_GetObjectClass_ReturnValue"

with a reference to Set ParentMass

which has to do with the following BP setup:

enter image description here

I am pretty sure this is happening because I am trying to retreive the mass of the parent but im doing it the wrong way.

Could anyone help me with retreiving the 'mass' value of the parent object?

Thanks!

Tea-F-Tea
  • 113
  • 1
  • 8

1 Answers1

0

What you're looking for is just the object reference to the parent planet, not it's class.

  1. In your moon blueprint, make a variable called ParentPlanet of type BP_Earth object reference (or whatever the name of your earth BP is).

  2. Click the eyeball beside the new variable to make it instance editable

  3. Back in the main viewport, click on your moon in the world outliner. You should now see an option in the details panel to select the parent planet.

  4. In BP_Moon, on begin play you can now get the parent reference, get it's mesh component, and use the node GetMass to find the mass of the mesh.

In your moon blueprint

The details for your moon