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"

How to get a click on object command working?

Hi there im wondering if anyone out there can help me. This is my very first time using UE but i keep hitting a brick wall with the blueprint like for instance i need to make a control that i can click on a static mesh and destroy it.. now it works perfect when i assign a key but i need it to work when i physically click on the object. iv been trying to work this out for 8 hours now and im all out of ideas the trigger just does not fire at all. any help would be appreciated here is what i have so far

alt text

Product Version: Not Selected
Tags:
ue.png (289.5 kB)
more ▼

asked May 11 '14 at 05:40 PM in Blueprint Scripting

avatar image

RuthlessImaging
1 1 3 2

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

3 answers: sort voted first

So I think I figured out the problem (always something minor you overlook).

Give this a shot, bypass all the branching and hook the OnClicked event directly up to your destroy actor like you did in your first post.

You don't need the Get a Hit Result or any of the Branching because the OnClicked event is already registered to determine if it was the specific object that was clicked on (in a project I've created, I have a Confirm event which is tied to Left Mouse Click - rather than specifying if a specific object was clicked which is why I needed the checking to occur, for your example you shouldn't need it).

Clicking anywhere but on the mesh shouldn't do anything while clicking on the mesh should register and fire off any events that follow it.

-W

more ▼

answered May 16 '14 at 04:18 PM

avatar image

DizzyWes ♦♦ STAFF
5k 145 64 206

avatar image RuthlessImaging May 19 '14 at 11:17 AM

yeah its all working now :) always the smallest of things Thanks again

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

Try using Left Mouse Button node as the event originator.

more ▼

answered May 13 '14 at 11:10 AM

avatar image

Zeustiak
1.8k 130 68 110

avatar image RuthlessImaging May 13 '14 at 12:36 PM

hi zeustiak that does work however that's if i click anywhere i need it so that when i click on the object it triggers

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

Hey,

Try giving this a shot:

alt text

Swap out Shape_Cube for your "MyMesh" actor. The Blueprint above returns what was under the mouse cursor when clicking and if it is equal to the mesh provided (Shape_Cube in my example) then execute the script following the Branch (which just prints a string now - but you can Destroy Actor and Play Sound after the branch).

Hope this helps,

-W

onclicked.png (92.0 kB)
more ▼

answered May 13 '14 at 01:32 PM

avatar image

DizzyWes ♦♦ STAFF
5k 145 64 206

avatar image RuthlessImaging May 15 '14 at 01:07 PM

Thanks wesbun i'll give this a go

avatar image RuthlessImaging May 15 '14 at 01:58 PM

Hey wesburn copied it exactly too see if i can get that script up first and still no fire when clicked on :( alt text

b.png (128.7 kB)
avatar image DizzyWes ♦♦ STAFF May 15 '14 at 04:14 PM

Which Blueprint are you doing the script under? For the example I provided, I was doing it in the LevelBlueprint as it was being used for a Menu (Similar to SwingNinja).

-W

avatar image RuthlessImaging May 15 '14 at 04:24 PM

mine is also in the LevelBlueprint.. i'm wondering if i'm missing something else other than the script to get it working

avatar image DizzyWes ♦♦ STAFF May 15 '14 at 04:31 PM

I am also using a different Player Controller for the Menu than the default controller. What controller are you using?

alt text

You'll have to enable click events in your controller:

alt text

-W

gamemode.png (20.4 kB)
avatar image RuthlessImaging May 15 '14 at 04:46 PM

ah iv taken a controller from one of the example maps (memory one) and been trying to use that as dint know how to create my own alt text

i cant seem to find the GameMode anywhere ?

b2.png (9.2 kB)
avatar image DizzyWes ♦♦ STAFF May 15 '14 at 05:29 PM

Go to the World Settings option at the top of the tool bar next to the Blueprints button. In there you can set the GameMode and assign your controller.

-W

avatar image RuthlessImaging May 15 '14 at 05:49 PM

okay iv done that and it still wont do it.. but in the script i can see it firing up to the first branch and nothing after that so some progress

avatar image DizzyWes ♦♦ STAFF May 15 '14 at 06:27 PM

Hmm.. just tested this and was able to destroy my block and play a sound with this setup, would you be able to post a video of it in progress? You're seeing the Blueprint wires activate up to the first Branch when clicking on the object?

-W

avatar image RuthlessImaging May 15 '14 at 10:10 PM

iv tried to upload a video in avi, mov and mp4 format but it just says invalid file type all the time what is the file type? iv got a video of it stopping at the first branch, is there an email i could send it to?

avatar image DizzyWes ♦♦ STAFF May 16 '14 at 12:50 PM

Post it to Youtube or something and I can take a look that way, appreciate it. It will help me determine what's going on as I've been able to successfully produce what you are after with the setup I've shown.

-W

avatar image RuthlessImaging May 16 '14 at 01:49 PM

all done sorry about the poor video quality its the best one i have but hopefully you can tell whats going on, on it here is the link https://www.youtube.com/watch?v=t-BUgBfG6aQ&feature=youtu.be

avatar image DizzyWes ♦♦ STAFF May 16 '14 at 02:56 PM

Thanks for the video, unfortunately I am unable to determine what the issue is based on it. I've just created a new project and tested it again and I'm able to get it to work.

alt text

Wondering if it has something to do with the mesh asset you are using to click on. Is it a Blueprint that you are using or is it a Static Mesh object. What are the collision settings for the object as well?

newproject.jpg (189.3 kB)
avatar image RuthlessImaging May 16 '14 at 03:24 PM

hmm strange...it is a static mesh created from the brush tool alt text

and the collision settings on it are.. alt text

(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