Attach actor to other actor location issue

Hi,

I’m working on a VR game and I’m trying to attach actors to a main actor and force them to align in a circle around the main actor’s center.

For that, I’m using three BP, the main actor is the Carrousel, a second one is a spline the third one is the class of the actors that will go onto that circle.

The idea is that the user can grab the actors and swipe the entire circle around him hence the spline so that the grabbed actor can only move around that spline.

I’ve managed to make the spline as a circle around the Carrousel actor and also to put the grabbable actors on that circle.

Now, my first attempts seemed to work but was not working perfectly. I was using the vector of the subtracted original grabbable object position and its new one with the Find closest point on spline.

It’s working fine for object in front of the user but not on those behind which by thinking about it is normal, if the user goes to the left, the object in front follow and go left but those behind go left too instead of right.

So to solve this, I’m trying to make the main carousel rotate around its axis so that all objects on the circle will be affected (except the grab one that is ignored).

For that, I’m attaching the objects to the main carrousel with the node Attach Actor to Actor and this is where I have a problem.

No matter what I try or at what moment I put this node, I can’t manage to not have it affect the grabbable actors position :

In the keep location relative, they go like this instead of being in the circle like before :

There are in circle but not around the main carrousel object (the gizmos on screen)

If I put the Attach actor in Keep World mode, it puts the actors into “two positions” in front and behind the carrousel actor like this :

What I want is for them to stay like this :

I’m setting their position with the set actor transform to get them along the circle with this simple function :

I tried to change it by Set Relative Transform but it gives even weirder results.

Thanks in advance

I don’t know if it’s the spline not helping, or some sort of local/world problem, but I can think of a couple of simpler ways.

  1. You can have any number of scene components in the center. When the user wants to ‘move a ball’, you can attach it to one of the scenes, and just rotate the scene.

  2. Rather than using a spline, you can just use the formula of a circle, or ‘rotate vector around axis’.

1 Like

Hi, thank you for your answer

  1. I tried to attach the balls to the carrousel scene root component and also to the carrousel actor itself, I still have the same transform issue where my circle positioning function is not working anymore, whether I attach them before or after applying the circle function.

  2. Yes that is what I wanted to use but I need to be able to keep the balls in circle first.

Thanks

  1. You need to attach the sphere to the carousel scene, then rotate that scene.

  2. It’s a pretty easy node to use. Have you tried?

When I attach the spheres to the carrousel scene root component, their circle disposition is not working anymore, I need them to stay in a circle around the scene root component before attempting to moving them. It acts like my second pic in the original post, all the spheres are stacking in one place instead of being line up on a circle, with keep relative or keep world.

Once they are correctly on a circle yes I can use the rotate around axis that was my original idea hence why I need to attach the spheres to the carrousel so that they can follow its rotation.

I made a number of sphere components and attached them to a central node with

Then, I just add rotation to each ball’s central scene using tick

rotate

Yes but there are not positionned in a circle around the central scene component like my third pic, they need to be in a circle and move as a circle around the central scene.

Also, I can’t use the construction script, the Carrousel, the moving cubes, the grabbable spheres (they will be arrow in the final project, here sphere are just placeholders) and the spline are all different BPs.

Here what’s firing at begin play in the BP Carrousel, the BP that acts as the center around all the others needs to turn around :




It doesn’t matter where you do it ( construction or event graph ), the principle is the same. Same with separate blueprints.

I can distribute them around the edge, for example

rotate2

I will look at your code a bit more… Ok, looks a bit of a nightmare :wink:

Tell me what needs to be a separate BP? The carousel and the shapes ( each )?

Yes, the carrousel, the shapes, all need to be separate BPs.

I’ll try to move the attach node to the spawn function so way ahead before I put them in circle to see.

Ok. Now my BPs only have this

and the carousel

rotate3

Thank you for your time.

How did you line them up in a circle around the carrousel actor ? How do you control the circle radius ? And where do you attach them to the carrousel ?

I copied my functions in blueprintue so it’s easier to read.

How did you line them up in a circle around the carrousel actor ?

The shape is just the required distance from the center of it’s blueprint

image

The carousel just spawns them at its own location, so it will always work.

How do you control the circle radius ?

It’s just that distance shown above.

And where do you attach them to the carrousel ?

In this case, they are not attached. Each BP simply revolves around its own center.

Yes but they need to be attached so that they follow the center rotation when user gives the order to rotate. The core of my problem is the fact that attach actor to component or to actor messes up with the transform I apply to the attached actor, no matter when I attached the actors to the other actor or component.

They can still be attached, even though they’ve been spawned.

I just attached them to the ring, it works just the same

Yes.

But why does the attach node interfere with the attached actor transform ? In my case, it does not give the same result

It doesn’t for me.

Well it does for me no matter if it’s in Keep relative or Keep world.

Are you using ‘attach actor to actor’?

Yes, I tried Attach Actor to Actor, Attach Actor to Component, Keep world, Keep Relative.

I tried Set Actor Transform and Set Actor Relative Transform.

The keep relative and set actor transform line them in circle but the circle is translated to the right or left of the carrousel actor instead of being around it with it as its center.

UE 5.0.3 and the project was made in 4.27 with the VR Collaborative template.

I’m using 5.1, but I think it will be the same.