How to stop child from moving/rotating with the parent?

Hey,

You can spawn an actor without it having to be parented to the spawner. Just create a blueprint for thw spawn able mesh, with a static mesh component inside of it. Then from the player, spawn actor from class. Attach it to the player when needed and detach it when not.

I expect this to be kind of a very simple thing to accomplish or circumvent somehow, but I don’t have the needed idea for it.

So I want a freely spawnable Mesh to move with the Players view (just up front the camera, really) and since it’s spawned by Input from the player, I think it has to be a child of the player, say a mesh component.

This mesh is supposed to follow the linetrace of the camera, which it also does while the character is not moving.
But the moment I start to rotate (by walking in another direction than the character was turned to until that moment) the component spazzes out until the character reached its target rotation for that direction, so it tries to follow up the rotation movement but is stopped by a tick event setting it back to the linetrace hit location (which is just the thing it’s supposed to do).

How can I stop it from happening? Is there another way to do something similar without a child component, so that it wouldn’t follow the player? Or can I just detach it from the character somehow?

Thank you very much for every helpful hint.

Kind regards,
Nickcha

Just in case my explanation wasn’t sufficient, here’s a video of the problem:
https://1drv.ms/v/s!AhVb4B00yLdPgbwU7kluzzpc02FrSQ

Does your Character Actor Blueprint has a Camera Component? If so, you could just add the mesh as child of the camera at the desired relative location. A socked, spring arm or something like that could help.

@Nickcha… welcome :slight_smile:

I agree with @BreakMaker, though you could also turn on and off… as needed… the Set Absolute node for components which would a similar effect. I think it might be just a bit tidier and more optimal than detaching.

If you are spawning an actor and using a child actor component, you could use it similarly.

Set Absolute node = Set which parts of the transform should be relative to parent and which should be relative to world

2 Likes

I think your solution will be the right one, I’ll test it tonight (in about 7 hrs), just didn’t consider spawning a different actor, since I just wanted the mesh to appear.

So the solution will most probably be to keep the process basically as is and just spawning a separate actor instead of the child mesh.
Will confirm when I get the chance this evening.

Thanks!

That’s actually something I’ve tried, maybe I didn’t do it the right way, but I locked every axis on the spawned component but it didn’t fix the problem.

Anyway, I expect @Breakmaker to have given the right solution, I just didn’t consider it because I only needed a mesh to spawn, didn’t think of a separate actor, even though it’s so simple ^^

Hey @Breakmaker,

It seems this isn’t the solution, though I don’t understand at all why not. When the character turns it’ll still try to move with the rotation.
Might it be somehow related to the camera that is the character’s child and somehow disturbs the linetrace with the rotation? Though weirdly the camera does not rotate with the characters rotation, it’s just a wild guess… I did not change a thing about the camera, it’s the basic setup from the ThirdPersonCharacter.

Do you have any other suggestions?

Why not put the mesh where you need it ( relative to the camera ) and make it hidden. Then during gameplay just unhide it…?

Because it is supposed to move while visible during gameplay.

So…noone who could help me with this?

Hello Nickcha,

If I understand well, you simply attach an actor to a camera, while the camera is moving following a spline/path, and you want the actor’s rotation to be independent from the camera rotation or path ?

If that’s correct, then attach your child actor to the camera actor via Blueprint or Code and use AttachActorToActor, important part here is the Location Rule and Rotation Rule parameters, make sure you set the Location Rule to ‘Keep Relative’, and the Rotation Rule to ‘Keep World’.
I do that for my own project and it does behave as I want, no rotation. Settings Rotation Rule to Keep Relative was rotating my actor, and the controls were completely screwed up.

Let me know if you have tried and what was the result, Good luck !
Attach

1 Like