Spawning objects with y axis pointing towards player

I have an early version of a game in which you can plant objects onto your planet. I have code that spawns the correct object at the correct location but I would like the objects to face outwards (away from the planet). I will post reference images to make this easier to understand this will also contain my code so far. Any help will be appreciated!

alt text

278114-getting-spawn-location.png

Had to dust off a bit of trig for this one.

Instead of plugging the location vector directly into the spawn transform, break the spawn transform so you can see the rotation, location, and scale. Go ahead and connect the 2 spawn locations now and split the struct for the rotation.

Now, drag off another pin from the spawn location so you get the XYZ coordinates. Take the ATan degrees (inverse tangent) of Z/Y and plug that into the roll of the spawn rotation.

https://api.unrealengine.com/INT/BlueprintAPI/Math/Trig/index.html

Thank you very much! This will help so much! I will get on to doing this right away :slight_smile: