1
\$\begingroup\$

I'm trying to make a game where my character rotates towards cursor (that works). He can choose between a few weapons (also works). One of the weapons works like a machine gun. My idea was to make a simple solution with:

Event tick -> gate (opened by pulling LBM and closed by releasing it) -> gate (closed after firing and opened after some delay) -> spawning projectile which leads to a sequence that closes / opens the second gate.

This doesn't work

It doesn't work perfectly. The projectile spawns with the right scale and location, but the rotation is always pointing straight forward.

If the exactly same blueprint is attached to anything else (straight up to the LMB pull or a timer), it works perfectly. However, doing the LMB pull defeats the whole purpose, as it's not a machine gun any more, and timer... is less then perfect I believe. I liked my solution using gates but it just doesn't want to work.

For example, this bit works with no problem (even though the spawning and rotation code is literally copy pasted): enter image description here

Does anyone have an idea on how to fix this?

\$\endgroup\$
5
  • \$\begingroup\$ Why do you believe the timer solution is worse? It seems much sinpler. \$\endgroup\$
    – Rotem
    Dec 1, 2020 at 2:00
  • \$\begingroup\$ It's less "clean" or "elegant", that's for one. It requires another event to be used and I have to remember about disabling it. The second image is much simpler only because it has just the basic functionality - this means, no stopping the timer, no cooldown etc. \$\endgroup\$
    – lilKriT
    Dec 1, 2020 at 2:13
  • \$\begingroup\$ Another reason is that I am just curious to why it's not working in the way I first tried it. I know, silly reason. \$\endgroup\$
    – lilKriT
    Dec 1, 2020 at 2:43
  • \$\begingroup\$ What is the Arrow referencing? \$\endgroup\$
    – Stephen
    Dec 1, 2020 at 11:59
  • \$\begingroup\$ @Stephen Arrow is a utility object in UE4. It basically shows you direction in the editor, while being invisible in the game. \$\endgroup\$
    – lilKriT
    Dec 1, 2020 at 14:12

1 Answer 1

2
\$\begingroup\$

I found out what is wrong.

Apparently, the rotation of the gun finished only after the projectile was spawned. (It's weird because it doesn't happen usually).

This fixed it:

enter image description here

The setting in red is the default one. Any of the green settings are good enough for this solution to work.

I hope that someone with similar issue finds this one day and saves some time :)

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .