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"

Get surface type on mouse click not working?

Hello everyone,

lately i've been fooling around with some blueprints and tried to make a point a click. So whenever i click i save that location and send the player to it. But then i noticed i can click on walls and some other unwalkable parts and the player tries to go there stopping at the wall. Well not much of a problem with that.

But then decided to show a marker where you click just to show you exactly where the character will go, the problem is that the marker appears on walls too and that's pretty ugly.

So i wanted to get the surface type and check if it's of floor type and only then spawn the marker and move the character.

The problem is that it doesn't matter where i click with the mouse, it always return the same surface type...

I'm using "Get Hit Result under Cursor by Channel" node to get the hit result. Then from the hit result pin i connect it to "Get Surface Type" node, then a "Switch" from this node that gives me 3 output pins: "Default", "Floor", "Walls" (those 2 i created them in project settings). For testing purposes made some prints nodes to check the return value: Always "Default".

alt text

I made the phys material for the floor and set it up on the floor material too (even tested with the hit of another actor and for that actor it's working properly but not for the mouse). The setup is pretty simple isn't it? You set up the physical surface in the project settings/physics, then you create a physical material in the content browser, in its properties you set the desired physical surface. Then in the material you set that created physical material. And then just set this material to the desired object.

What am i doing wrong?

Thank you in advance for any help!

Product Version: UE 4.8
Tags:
more ▼

asked Aug 02 '15 at 03:04 PM in Blueprint Scripting

avatar image

Meguido
35 3 5 10

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

2 answers: sort voted first

I think that you may be over thinking this with using physics and physics materials. Simply create a new collision type called Floor (set its default behavior to ignore so all current and future BP collisions will ignore it), set your floor BP collision to block Floor then do your "Get Hit Results UnderCursor By Channel" and switch the enum of the trace channel to Floor. This will only return hit results that have the collision Floor set to block.

Hope this helps! If it does then please do me a favor and accept the answer by clicking the check mark located under the arrows next to the answer. Thanks!

more ▼

answered Aug 03 '15 at 11:43 AM

avatar image

jtsmith
1.4k 70 29 92

avatar image Meguido Aug 04 '15 at 05:11 PM

Thank you for your answer! It's not a bad idea but i can't seem to extend that to differentiate when I click on the floor, on a wall or in an item to grab. Based on surface types i was able to do that... but since isn't working with the mouse i'll have to look for another way.

avatar image jtsmith Aug 04 '15 at 11:15 PM

If you have a decent Parent/Child setup for you blueprints then you can always check against that for the object hit. i.e. if all your grab-able items are based off the same parent BP "Grab Items" then when you get the Hit Result from your cursor trace, you can check to see if it is derived from the "Grab Items" BP and if it is, change your logic to adjust.

You can also use a the "Get Hit Results Under Cursor By Object" which takes in an enum of the object you want to hit. Hit result then only returns something that was part of that enum and you can set logic accordingly.

Hope this helps. Let me know if you need me to explain further.

Jesse

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

Can someone please test this out and report back with the result? I'd like to know if it's just me or it's a bug that should be reported

more ▼

answered Aug 03 '15 at 11:29 AM

avatar image

Meguido
35 3 5 10

(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