Download

Rotating a mesh and updating a Vector

I have a mesh (turret gun) which rotates, and i have Fire Location - vector i set in the BP, as editable so i could place it where i wanted on the gun
when my gun rotates the Fire Location doesnt update its location with the new rotation

what is the best approach for this ?

You can either attach the fire location to the end of the turret. Or, you can do the math regarding turret base rotation vs the vector at the end of the turret barrel and update your fire location vector accordingly.

What I would do:
In the comoenent setup, I would add an arrow component at the end of the turret mesh (as a child component of the static mesh). For firing, you simply get the World location and Rotation of this arrow componenent and use them to set the Transform of the projectile. Or if you are using a skeletal mesh, use sockets.

hi mindfane, I tried this setup but it still doesnt behave correctly.
Im getting MyCannon->MyArrow->World Location & World Rotation

and because im doing this as a side scroller im making sure the World Location.X = 0.
but the fire location is still off and/or sometimes in the wrong place (after messing with the Rotation values)

any other pointers you could give by any chance ?

ah right the Fire Locaiton does seem to update correctly, but the Firing Projectile fires in the wrong direction :S

when it points to the right, the projectile fires out, when it points to the left the projectile spawns but doesnt go in that direction…