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"

Getting bullets location when stopped

Hello i've made a blueprint script where when i click for example right mouse button it tells the bullet to stop.I'm using the stop projectile movement immediately node for this since i can't get the constrains to work properly.Anyway i would like to get the location when the bullet is stopped but if i set a variable where it gets the bullets location it gets the wrong location.Does anyone have any suggestion how i can proceed from this?

Thanks for the help.

Product Version: UE 4.19
Tags:
more ▼

asked May 03 '18 at 03:16 PM in Blueprint Scripting

avatar image

GreenEclipse
6 4 8

avatar image Velrin May 03 '18 at 03:19 PM

How are you setting the variable that gets the bullet's location?

avatar image GreenEclipse May 03 '18 at 03:25 PM

I create a new variable for vector and i get the location right after it stops the bullet at least in the blueprint and then i set it to the location of the bullet

avatar image Velrin May 03 '18 at 03:27 PM

Can you take a screenshot of your blueprint where you are assigning the vector variable with the location?

avatar image GreenEclipse May 03 '18 at 03:38 PM

Ofcourse here it is :alt text

stopbullet.png (127.4 kB)
avatar image Nebula Games Inc May 03 '18 at 08:18 PM

Sorry for the silly question but how do you know it is the wrong location? Like what else are you trying to do that makes you realize the bullet is in the wrong location?

avatar image GreenEclipse May 03 '18 at 08:29 PM

Well i tried using the transform node to move it to that location and it just dissapears.

avatar image Nebula Games Inc May 03 '18 at 08:31 PM

What do you mean using the transform node to move it to that location? Isn't the bullet supposed to already BE at the location? I am confused.

avatar image GreenEclipse May 03 '18 at 08:33 PM

Yeah but i stop it and it starts falling to the ground. So i tried setting it to that location where it stopped and started to fall to see if i got the location right Sorry for the confusion

avatar image Nebula Games Inc May 03 '18 at 08:47 PM

You can change the "gravity" setting on the projectile movement that will keep it from falling. Otherwise you can just save the world location and delete the actor then it won't have the ability to fall. Again not sure what the "over all" goal is with getting the location if you could explain the set-up and desired functionality more I could give you a better answer.

avatar image GreenEclipse May 03 '18 at 08:58 PM

I want to make it like example : Shoot the bullet forward when the player decides to stop it he can with a right button.When it's stopped i want it to slowly fall to the ground(some sort of timer).While the bullet is slowly falling i want the player to be able to teleport to that location where the bullet was stopped.If the bullet collides with anything it's destroyed and you can't teleport there

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

1 answer: sort voted first

Here you go. This works. I tested it out. Just add whatever script you want to this basic set up.

alt text

alt text

alt text

alt text

bullet-1.jpg (153.7 kB)
bullet-2.jpg (188.1 kB)
bullet-3.jpg (138.0 kB)
bullet-4.jpg (206.9 kB)
more ▼

answered May 03 '18 at 09:00 PM

avatar image

Nebula Games Inc
5.4k 28 9 15

avatar image Nebula Games Inc May 03 '18 at 09:02 PM

Also, reading your latest comment, if you save the "bullet location" on the bullet BP and it gets destroyed you can't teleport there because you lose that data of where the bullet is when you destroy the BP. If it is stored on the player you need to properly reference the bullet to get the spawned bullet's location within the player BP.

avatar image GreenEclipse May 03 '18 at 09:06 PM

Oh ok i'll try saving the location in the player bp.I'll try redoing it tomorrow it's getting a bit late. Will let you know if what you suggested helped me out. Thanks for the help either way :)

avatar image Nebula Games Inc May 03 '18 at 09:07 PM

Sure, if not let me know what's wrong we will get to the bottom of it haha

avatar image GreenEclipse May 03 '18 at 09:08 PM

Hehe will do good night :)

avatar image GreenEclipse May 04 '18 at 01:13 PM

It works now. I guess i had to destroy the actor before moving the player to that location or i had t move the stop bullet function onto the player bp instead of the bullet bp

avatar image Nebula Games Inc May 04 '18 at 02:47 PM

Glad you figured it out.

avatar image GreenEclipse May 04 '18 at 02:49 PM

Doubt i would do it without you so thanks :) i'm gonna try and learn to constraint that bullet since i don't like the stop movement immediately. Just need to find a good tutorial do you maybe know of any ?

avatar image Nebula Games Inc May 04 '18 at 02:52 PM

Haha, no problem man. What's the issue with stop immediately now?

avatar image GreenEclipse May 04 '18 at 02:58 PM

nothing but i want to make different kinds of weapons like for example first one is the teleport one which i mentioned. Second idea is similar to the first one the only difference would be that when i right click it stops the bullet in the air and stays in the air for a couple of seconds in the meantime the player can choose which direction should the bullet continue from the freeze spot.So you can basically shoot in an L shape. So i need to learn how to hold the bullet in the air.

Sorry if my explanations are a bit crappy i hope you can understand what i'm trying to say :)

avatar image Nebula Games Inc May 04 '18 at 03:14 PM

You can still use "stop immediately". Then once the player has selected the direction to move the bullet in, "set velocity" to that direction. I dunno what kind of "directions" you want to have but basically you will create the vector somehow from whatever the player "chooses" however you script that then you set projectile movement velocity to that vector and you're good. I just tested this out. It stops mid air, then I set velocity to some new vector and after a delay it takes off in that new direction. Just up to you to figure out how you want to create that vector from player's choice.

avatar image GreenEclipse May 04 '18 at 09:35 PM

Is there anyway to set velocity of a spawned object right after it spawns? because if i try to set it after the spawn it doesn't work

avatar image Nebula Games Inc May 05 '18 at 05:49 AM

You said the same thing "after spawn" and "after spawn". But either way, before or after the answer is yes. Before, you set the velocity in the projectile's blueprint. After you "get velocity" and set it to whatever you want.

avatar image GreenEclipse May 05 '18 at 07:14 AM

Sorry was a bit tired :)alt text Here is how i did it but it doesn't work.I've tweeked the settings to be at 0 velocity for xyz and i've also change the initial speed to 1500.But still can't figure out why it just spawns in front of the character and then falls to the ground

screenshot-40.png (101.7 kB)
(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