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 rotate bullet in the air?

I make a turret, who aims it's head at character. The new problem I have is turning a bullet. When it spawns, it gets impulse and flies away, but don't rotate. I want to make it rotate with cone's nose parallel it's moving like real. Thanks!

Product Version: UE 4.19
more ▼

asked Jul 11 '18 at 08:23 AM in Blueprint Scripting

avatar image

1 2 3

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

You can use "Find Look At Rotation" to rotate the bullet, giving the vector values:

  1. Spawn location of bullet

  2. Location of target

Setting this once will give you a fixed rotation that won't change, so it assumes your bullet does not have physics rotation that will change it. You can also update this rotation per frame if you wish to, which involves changing the first vector value to the current bullet location, which updates. This means the rotation will be pointing toward the target location at all times, even if the target moves.

You can also use the VELOCITY (Get Velocity / Get Component Velocity) of your bullet to determine which direction it should face. Using "Find Look at Rotation", first value as your bullet location, and second value as the bullet location + velocity. You can either make sure that this rotation happens after the bullet receives an impulse (and has already a velocity higher than zero) or call it every frame (reducing performance).

more ▼

answered Jul 11 '18 at 10:03 AM

avatar image

240 2 4 7

avatar image RenegadeCash436 Jul 14 '18 at 09:05 AM

If I use velocity, then bullet flies in 90° rotation against trajectory and when collides the floor starts histerics:).

(comments are locked)
10|2000 characters needed characters left

Give the bullet actor a "rotational movement" component and set the rotation of the "X" axis (roll) to whatever speed you would like. This way when the bullet is spawned it will rotate around the forward vector axis like a real bullet.

more ▼

answered Jul 11 '18 at 10:26 PM

avatar image

Nebula Games Inc
3.5k 20 9 14

(comments are locked)
10|2000 characters needed characters left
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