Position constrain actor to actor?

I want to position constrain an actor to another, ie when the parent actor moves the child follows but the rotation does not get inherited. How would you do this?

At the moment the only solution I can think of is to rotate the child actor with the opposite rotation value of the parent… seems a bit too hacky for my liking. :confused:

This question would be for subcomponents of the [ROOT] SceneComponent as well if there’s anything one can do there.

I basically I have a tetris type game, I have an actor (called parentblock) which I want to control the falling blocks with and hence want those falling blocks following the parentblock but not its rotation…

Thanks.

Hi ,

When you set this up. What you will want to do is break the vector of the parent-blocks location, and (I’m assuming your game is falling down on the Z axis for Tetris style play) you will only want to get the X or Y coordinates (depending on which axis you use for left to right movement) from that parent vector. Just append this to the movement setup you have for the parent block. If you need to use it in a second blueprint that is the child of the original (more likely), then what you can do is set it up to cast to the parent block and call on the movement, then add the break/make vector and set relative location there.

The easiest way is to set ‘Absolute Rotation’ on the child! That way it will inherit translation, but rotation will be treated as relative to the world instead.

Thanks , is there an easy way to work with an offset to the parent though? So let’s say a child block is 100 units away from the parent block (ie the controller) and when that parent is rotated the child’s position gets offset as if it had been rotated, but the child’s local rotation always stays the same in world space. Kind of like a straight parent actor to actor but the child actor is always aiming in one direction no matter what the parent’s rotation is doing.

Thanks that works just like the doctor ordered!

One funny thing though, I first tried this by adding an arrow and putting it under my [ROOT] which actually gave the arrow an odd translation offset each time I rotated it with absolute rotation on. When I parented it under my mesh (which is also a child of [ROOT]) it did not get this odd translation and worked as expected. Then I added a second mesh instead and this mesh behaved as expected without the translation offset no matter where in the hierarchy it was.

Basicly an arrow and a mesh worked differently with - AFAIK - the same settings. I just thought I’d flag it in case it’s not expected behaviour.

Thanks again!

Ok I’m a dumb dumb… the arrow’s pivot isn’t in the middle… right right, onwards and upwards.

Cheers.