Download

Help: Rotating a Blueprint with another BP

Hi All

I am spawning Blueprint in the Level and would like them to spin on the spot.

Tried this, no luck. Runs off event tick.

Any Ideas

Narg

Two things:

The rotation code should be in the actual Fighter BP rather than where you are spawning it … OO code and all that …

Rotating the character requires you to get the current character and add a rotator value to that, times the delta time, which you can get from the event tick. I dont have the editor installed on my work machine so cant provide screenshots. You also might want to consider a speed float so you can vary it, which would be times the delta time.

A basic version can be seen here:

You can also add a rotating component to the actor if you want the simple approach:

That is a shame. Could I do this with a Static mesh instead?

If so, how to spawn a static mesh?

b445697e25b8189ccccc5d9c1b2f88260719a311.jpeg

Thanks for the help

Narg

Or would I add all 18 static meshes in to the BP and do it that way.

I am testing for now, because later there should be 100+

Narg

Your FighterBP should have the static mesh already inside it (I am assuming thats what you are doing as it wouldnt make sense to do it any other way)…

You just need to add the code on the Fighter BP instead. You could of course add the rotation code to current BP above, but as stated that’s not very well designed. Both examples given should get you started.

My only thing I can see being a problem, is that with 100 of these that I would have to cast to everyone one of them when I need them

To summarise, they will be spinning on the spot like a display in a store, but later on they will be used for fighting and other tasks. So I would have to tell everyone one of them when to start and stop spinning.

That way, I thought I should Spin the Static mesh instead of the BP.

I will look in to it further, Thank for advise.

NArg

What about just using Add Actor Local Rotation instead of Set Actor Rotation? Then I don’t think you need to keep track of it’s current rotation.

How are you keeping a track of all these objects? … Might be worth considering putting them into an array, if you need to iterate through them quickly all at once you just create a for loop and run what you need to on each. Also what will initiate them to ‘start fighting’ a collision? Or the player being a certain distance away? Or something else?

Create a function in the FighterBP that does the other tasks, and then call that when the condition is true, either automatically from a collision or ray trace if you are doing a distance check. This can be part of the BP for FighterBP, that way you don’t need to worry about iterating through each one, they will just look after themselves and be automated. That of course might not be what you were trynig to achieve.