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"

Actor not spawning at mouse location

Hi, I was trying to spawn an actor on LMB at cursor location, however, the objects spawns only in the middle of the screen.

Here's my blueprint.

alt text

Where is the mistake?

Thanks for help in advance.

Product Version: UE 4.13
Tags:
spawn.jpg (130.7 kB)
more ▼

asked Mar 18 '17 at 07:00 PM in Blueprint Scripting

avatar image

Kony
12 2 4 7

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

2 answers: sort voted first

Try this:

alt text

(Just add your array in of course)

spawn.png (124.1 kB)
more ▼

answered Mar 18 '17 at 07:09 PM

avatar image

Mosel3y
1.8k 49 22 67

avatar image Kony Mar 18 '17 at 07:14 PM

I tried, nothing spawns. :C

avatar image shotty46290 Mar 18 '17 at 07:18 PM

getting mouse location to world space does not work. And there is some math you have to do to get it into the right spot. There is also no Z location of a mouse click and you will have to get that another way.

avatar image Kony Mar 18 '17 at 07:20 PM

The reason why there is no Z is because it is a 2d project.

What kind of math?

avatar image shotty46290 Mar 18 '17 at 07:23 PM

I will look where I did it and put up a snap shot of it. But I'm saying there is no Z period on mouse click whether its 2D or 3D. I have an AI which moves on mouse click and you have to create the Z axis location

avatar image shotty46290 Mar 18 '17 at 07:28 PM

here is a screen shot of getting correct X and Y axis with the mouse to world space node. alt text

3.jpg (294.3 kB)
avatar image Mosel3y Mar 18 '17 at 07:35 PM

Also with Shotty's setup, if you change it to be dividing Y/Y on the break vectors, they will be on the Z-X axis innstead of X-Y. Or divide X/X, to have it on the Z-Y axis. The 3rd value you will have to set yourself, like shotty says.

My first example will only work if you have a position to collide with under your cursor.

avatar image Kony Mar 18 '17 at 07:37 PM

"Position to collide", you mean something like a wall? Did I understand correctly?

avatar image Mosel3y Mar 18 '17 at 07:42 PM

Yeah, wall, or any actor that has collision, collision that is set to BlockAll.

avatar image Kony Mar 18 '17 at 07:57 PM

Ok, I tried your solution once again and it worked. I've put a wall. But the object spawns only once per several seconds, don't know why.

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

Thanks Mosel3y, thanks shotty46290, your advice were greatly helpful.

more ▼

answered Mar 18 '17 at 08:34 PM

avatar image

Kony
12 2 4 7

(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