x

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"

Projectile shot sideways

Hello, I'm following the twin stick shooter tutorial and I've successfully made my gun shoot. But I'm there is a problem when I shot sideways, or not shooting straight up or down.

alt text

As seen in the image above, the projectile is shooting sideways. I've tried following the video, but I can't pinpoint where I'm making mistake.

video related: https://www.youtube.com/watch?v=FYMQLuUXjp8&list=PLZlv_N0_O1gb5sdygbSiEU7hb0eomNLdq∈dex=10

Product Version: UE 4.21
Tags:
more ▼

asked Mar 12 '19 at 07:55 PM in Blueprint Scripting

avatar image

Mikevil94
1 1

avatar image Tuerer Mar 13 '19 at 07:48 AM

Are you using the gun's forward vector for the direction? Because as I can see in the screenshot the projectile follows the gun's direction.

Try using the character's forward vector instead.

avatar image Mikevil94 Mar 14 '19 at 01:06 PM

The video didn't do direction. I tried looking since I see people use vector nodes in their respective projectile setups. But here is how my weapon is set up in blueprint. Both itself and when it spawns with character. alt text

charactergun.png (340.8 kB)
avatar image Tuerer Mar 14 '19 at 01:15 PM

Well yeah, you don't set the projectile direction, of course it's not going where you want it to go. In your setup the projectile direction totally depends on the SpawnPoint rotation, and since that's attached to the gun, so on the gun rotation, and it fires exactly where the gun is pointed.

In the Spawn Projectile node: clear the Spawn Transform pin, right click it and Split it. Do the Same with the GetWorldTransform. Connect Location and Scale to each other, but as for Rotation, Get Character's Rotation. Thus you'll make the projectile shoot straight where the character is looking.

avatar image Mikevil94 Mar 14 '19 at 03:54 PM

Got location and scale connected between GetWorldTransform and Spawn Projectile. How do I get Characters Rotation?

avatar image Tuerer Mar 14 '19 at 04:26 PM

alt text

rotat.png (29.4 kB)
avatar image Mikevil94 6 days ago

I should've explained the context better: when I shoot up or down, the projectile shoots normal (green line). But when I shoot left or right, the projectile shoots sideways (green oval).

As for the proposed solution, it didn't work. Projectiles still shoot sideways when looking left or right. Maybe I incorrectly connected something wrong? alt text

gun-update.png (487.9 kB)
(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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