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 do i click a static mesh and turn the player torwards it?

I'm just started using this program and have been searching everywhere for a tutorial for this. What I need is to be able to click an static mesh and then face that mesh. I do have a player controller with the mouse events activated. I guess my main problem is getting the mouse events to work. I have seen a few tutorials and I can get a simple click to work, but not by clicking a specific mesh. Thanks

Product Version: Not Selected
Tags:
more ▼

asked Jul 29 '14 at 12:45 AM in Blueprint Scripting

avatar image

Pectabyte
8 1 4 5

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

1 answer: sort voted first

What you can do here is make use of a node called 'Trace hit under cursor' (or a similar name). This node will return the Actor that is under your mouse cursor. So on the click event, you will call this node and get the Actor that is under the cursor. Check and make sure this Actor is the object you are looking for. You can then get its position and rotation which you can use to rotate your character.

Another option is to create a special blueprint for your 'clickable' meshes. You can add a click event directly in its blueprint, which will fire up when you click an instance of this blueprint. Then you can set the characters position/rotation.

if all the meshes in your level are clickable, go with the first method. IF there are only a few special objects that are clickable, go with second method

more ▼

answered Jul 29 '14 at 03:08 AM

avatar image

mindfane
3.4k 154 51 271

avatar image Pectabyte Aug 11 '14 at 07:51 PM

Thanks that really helped. I got it working now with everything except if I wanted an clickable event with a skeletal mesh. I applied the same technique. Looking for a little insight as to why. Thanks again

avatar image mindfane Aug 12 '14 at 03:05 AM

What is the issue you are having with skeletal meshes?

avatar image Pectabyte Aug 13 '14 at 06:31 AM

Basically here is what I have now. I can click a cube mesh and press the W key and fire a projectile at it. Everything is working perfectly. But if I apply the same method to a skeletal mesh(heroTPP), I get no response when I click it. I am using the same exact technique as I did the cube mesh. Not sure why it's not working. Note: This is from the 3rd person template and I copied the skeletal mesh from the mycharacter mesh.

avatar image mindfane Aug 13 '14 at 07:37 AM

Does you skeletal mesh contain a collision volume? Because if it does not, it wont be able to detect click, traces or stuff like that.

avatar image Pectabyte Aug 14 '14 at 06:55 AM

First, thanks you have been a huge help for pointing me in the right direction. Second, no it does not look like the skeletal mesh has a collision volume. After doing some research on collision volume I am unable to find a way to add a collision volume to my already existing skeletal mesh. So I seem to be stuck for the time being. For now I will continue to research and play with it. I do a lot of trial and error. Maybe with luck, I will get it :)

avatar image mindfane Aug 14 '14 at 08:18 AM

You will need a Physics Asset. You can set up those in Persona PhAT and they will define the collision volumes for the skeletal mesh.

Take a look at this: https://www.youtube.com/watch?v=10j4jn4VXxA&list=PLZlv_N0_O1gaCL2XjKluO7N2Pmmw9pvhE&index=5

and

https://www.youtube.com/watch?v=uOy0B3Tb7dk&list=PLZlv_N0_O1gaCL2XjKluO7N2Pmmw9pvhE&index=142

avatar image Pectabyte Aug 14 '14 at 04:08 PM

I got it! It is finally working! Thank you so much!

avatar image mindfane Aug 14 '14 at 06:57 PM

Awesome!

So how did you go about it? Added physics asset to your skeletal mesh or simply added a capsule component to the BP that is using the mesh?

avatar image Pectabyte Aug 15 '14 at 07:42 AM

Capsule component made more sense for the situation. Thanks

avatar image mindfane Aug 15 '14 at 04:12 PM

Ah, ok!

BTW, could you mark the thread as solved?

Thanks

(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