Imagine my actor is the sun. I’ve placed spheres around the sun in the blueprint and gave them rotational movement. How can I make the planets rotate around sun now? I’ve read something about using spring arms but nothing that sets it in stone for me.
One way to achieve this is by using a matinee where you need to :
- Right click at left down grey area and create new empty group
- Right click at the new empty group and add new movement track
- Select the object you want to set on rotation and go back to matinee
- Right click the new empty group and add actor >add selected actor
- Select the movement track
- Set movement duration and location at different moments of your object . You need to change the location of your object manually and the time in the matinee and add a new key to each location-time of the object
- Go to level blueprint and activate this matinee with the node Play and connect your matinee to it
- (Bonus) With some basic scripting you can set that matinee on loop . For example use Event tick node then create a boolean variable and each time check with branch node if that boolean is true. If yes play the animation. Then make the boolean false. Then use delay node for as long as the duration of the orbit is. Then set boolean back to true.
I am pretty certain you can achieve this totally through blueprint scripting by using nodes Get actor location , set actor rotation , get forward vector but I have not tried this myself . I hope I helped you. Good luck!
hmm i added a similar answer earlier but it didnt go through. you dont actually even need the spring arm, you can just place the mesh at the distance you want the orbit to be and it will still act in the same manner.
i cant find the thread made recently where i posted this example but the picture below shows how i implemented a rotating planet system. one of the major features here is that you can modify values like orbit radius, planet size, and you can use this to add moons which travel around their parent planet.
if you look in the variables section at the bottom left you will see the public variables i used which can be set in the details panel of the level editor on a per instance basis. note that rotation rate is the orbit speed.
True, true, one less component is always better. Op wanted a springarm so here’s one.
Hey, what you set up in your pictures are exactly what I’m aiming for. I’ve got what you have set up in mine but the sun spins as well. Basically the whole blueprint spins. How can I alter it to where just the planets rotate around the sun? Sorry that I can’t do it based on what you’ve given me.
@Everynone
No worries, I just followed your suggestions closely. If the sun is spinning, don’t use a rotating component in the sun. Use it just in the children actors. Depends on your setup.
I’ve got a space project myself but I’m using something a bit more advanced since my orbits need to be titled ellipsoids and the whole lot is generated procedurally. An object pooling system of splines + spline mesh components (to visualise the orbital mechanics) that any celestial marble can glide along. All controlled by a single timeline float in the parent.
Good luck!