Download

Replacing a mesh in game, Need to set it rot/loc to same as old mesh

I guess the title says it all, noob here :wink:

I have a button which replaces a rotating mesh (blueprint) (spawn from actor class) and deletes other mesh (blueprint).

But they always spawn with 0,0,0 rotation. I know there has to be an easy way to pass this info to the new mesh.

use get world rotation node from the original mesh, store the result as a rotation variable, on the spawn actor from class,right click the transform pin and seperate it and in the rotation, plug in that variable

before the mesh is replaced Use get transforms node & store that as a variable.
And when the new mesh is spawned you can set transforms node using the stored transforms variable as the new transforms.

Thanks guys, got it working a bit… Still buggy though.

So the first mesh (on the bottom) spawns on event tick (do once) (skips the destroy for actor who is not there yet).

When the top button is clicked, The current mesh is destroyed, various stuff to do with vars and button usability, Then actor spawns.

(IGNORE the unplugged stuff in this screen)

But then second mesh DOES NOT spawn with correct location.

However, if you click back on the first (bottom) button, that mesh DOES spawn at the new rotation of the second mesh. Going back and forth only gets the original to take the world rotation

Also getting console errors about:

OK, moving on…

**ixicalibur, **took a bit to figure out how to split the pin… that got me closer.

So now the errors are gone. Still same issue though.

I start map with object #1. (bottom). If I click button to spawn object #2 it spawns but without the rotation transform.

Selecting #1 spawns #1 WITH correct location. I can go back and forth 20 times. #2 doesn’t get rotation, #1 does.

can you achieve what you need by simply using “setStaticMesh” node and not destroying or spawning any actors?

Probably, lol. I’ll try it. Thanks

That was pretty accurate NotSo…

I’ve got everything swapping out mats and meshes now instead of respawing and destroying. Another round of cleanup.

Thanks everyone, the solution was simple but I learned quite a bit.