Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Product Version: Not Selected
more ▼

asked Jul 19 '14 at 07:13 AM in Blueprint Scripting

avatar image

21 4 6 7

avatar image Sletherot Jul 19 '14 at 05:45 PM

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?

avatar image Erasio Jul 19 '14 at 06:00 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

...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.

more ▼

answered Jul 19 '14 at 08:33 AM

avatar image

6k 291 86 293

avatar image Sletherot Jul 19 '14 at 06:19 PM

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

avatar image Erasio Jul 19 '14 at 06:43 PM

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.

avatar image Sletherot Jul 19 '14 at 06:48 PM

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.

alt text

avatar image Erasio Jul 19 '14 at 07:27 PM

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 ;)

I would do your Controller class like this:

alt text

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

spawn.png (161.2 kB)
avatar image Sletherot Jul 19 '14 at 07:55 PM

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.

avatar image Sletherot Jul 19 '14 at 08:12 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question