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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

Left Mouse Button Event to spawn ParticleSystem

I'm simply trying to spawn a particle system in the game space when the user does some mouse input.

The problem is the Left Mouse Button event isn't firing in my GameMode or PlayerController (tried both).

I also don't have any actor I'm interested in activating this with, I just want any click to spawn the particle system.

Edit: It's probably because I'm placing the Blueprint event in GameMode and/or PlayerController?

Edit2: I found this in the documentation which solves my issue, but I was hoping I wouldn't have to recreate the blueprint code in each level for the click event.

Use Blueprint scripting (either within the Level Blueprint or any Actor Blueprints) to process mouse interaction.

Edit3: So now I've attempted to get onClick events to fire for the Box Trigger and Trigger Volume but I'm unable to receive any events from them as well.

Edit4: So I added a Mouse Right Click event to the level editor; that triggers, and Mouse Left Click doesn't.

Anyone willing to explain why, or what kind of gotchas there are here, no idea what's going on now.

Product Version: Not Selected
Tags:
more ▼

asked Feb 28 '15 at 08:46 PM in Blueprint Scripting

avatar image

viisual
3 1 2 4

avatar image Maverinox Mar 01 '15 at 06:35 AM

can you provide a snapshot of your code

avatar image viisual Mar 01 '15 at 10:32 PM

I would if I thought it would help, I'm pretty sure it's a check box or setting somewhere I've missed or in my case enabled when I shouldn't have.

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

1 answer: sort voted first

Alright so by default nothing but your player controller and player character receive input and having input directly inside of your gamemode is pretty bad practice anyway because if you would ever decide to go multiplayer you will have to completely rewrite that.

However that it doesn't work in your player controller as well is rather strange. Have you selected the player controller in your gamemode? Or is that still using the default? Because that would mean you don't actually have the new code running when testing.

And as last little tip. Don't use those static events like (Left Mouse button) or (Space Bar). Go to "Edit", "Project Settings" and under "Input" you can define input events. But instead of just having a single button you can use there, you can add as many as you want. This allows you to enable gamepads without near to no additional work, it allows you multiple bindings and eventually fairly easy key rebinding (though not in BP only as of yet sadly).

I hope this helps a bit. I am absolutely unsure why it would work with right but not left click. Maybe a look at your setup would help but it seems rather strange.

Cheers

more ▼

answered Mar 01 '15 at 08:58 AM

avatar image

Erasio
5.9k 291 86 293

avatar image viisual Mar 01 '15 at 10:31 PM

I created a fresh project today to see if I could recreate my issue, I couldn't.

So a fresh day, I went back in to the code and started to clean up.

I had a few extra classes that weren't in use I removed. I unset the value "Automatically use input from player_0" on a few items, retested and left click works again.

Yea, I had it enabled in the game mode, I really have no idea what I changed that made left click fire alongside right click, because I went back and tried to check the things that I unchecked to no avail.

I have no idea what happened, what caused this, I'll just move on and hope I don't run into it again.

So I can mark this as answered, what blueprint node should I use to spawn anything at the location of the mouse click.Convert Mouse Location to World Space?

My desired outcome is to just place something visually where the user clicked, but in the world, it's a 2D game so all/most objects are clamped to the Y axis, so that makes it easier, hopefully.

avatar image Erasio Mar 02 '15 at 09:46 AM

Well there are two possibilities to do that.

"Convert Mouse Location to World Space" and "Get Hit Result under Cursor".

You can try both and look if that fits your needs. Everything else is quite a bit harder and pretty much involves you doing everything by hand.

(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