How to make my projectile stay linear along the z axis

Right now my transform is being rotated to face my click location. I would like it to do this but only for the X and Y axis. I would like it to stay strait along the Z axis. Is this possible to do?

…you have to set the transform somewhere. Just break it up, break the rotation up and set Z to 0 while taking all other variables from whatever transform you took them from.

My other problem that I am having is that I would also like my projectile to fire along the z axis instead of it falling due to physics. Any solution to that?

In the properties of your Projectile Movement component you can set if it should be affected by gravity or not.

I’m not sure if this overrides the gravity of your root so just in case turn the physics of your root component off just to be safe.

I have been trying to do this but I can’t seem to figure out how to only take specific variables.

Just take the pin from the transform and search in the contextmenu for “break”. The first should give you what you’re searching for. Break whatever variable you need as often as needed (for a transform probably two times since it contains location, rotation and another one I can’t remember the name xD. Anyway just break there whatever you need and create a new transform.

Perfect! Thank you so much haha, as you can tell I am new and am still learning everything

After I break it apart how do I set one of the specific values?

Here is my current blueprint.

First of all you shouldn’t use Sequence like that. I would just queue them up. It makes a lot cleaner code and it terminates the need to use that many variables. You can just pass them to the front.

And what exactly are you trying to create? As far as I can tell you want to click somewhere, then spawn a projectile which flies in that direction.

If it should be stable and not change on the Z axis you can do that in the defaults of the projectile movement actor by setting the “Projectiles Gravity Scale” to 0. Like that it will fly in a straight line.

That’s a property in your Projectile actor blueprint. The PlayerController class is only to change behavior from the player itself.

(It’s a wild guess that you use the PlayerController right now but “Get Hit Result Under Cursor by Channel” is a PlayerController node so if this is not the PlayerController then you should spawn the projectile there and do the rest inside that blueprint… and enable the Context on rightclick :wink:

I would do your Controller class like this:

And the rest in the projectile blueprint which you spawn out of this.

I have the gravity set to 0 but the problem is that the transform is being rotated to face where I click. That is exactly what I want it to do except that when I click near the top of an object it will fire in a strait line to the top of the object instead of just flying toward it on the X and Y axis only.

I GOT IT! Thank you for the help. we can let this thread die now.