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"

Cast to Character not executing

Hi all,

Im trying to create a mobile RTS game, with selecting a character with touch begin and moving it (animated) with drag and drop to the location of the touch end. But my cast to Character seems not to work. Its not failing, instead if I touch the character, nothing is happening. The character`s mesh has the collision preset "overlap only pawn". Can someone help?

alt text

Product Version: UE 4.10
Tags:
more ▼

asked Jan 28 '16 at 08:54 AM in Blueprint Scripting

avatar image

CornKrue
1 2 3

avatar image Sean L ♦♦ STAFF Jan 28 '16 at 01:43 PM

Hello,

Have you ensured that you have your character's collision set up to Generate Hit Events? If you have, could you please provide a screenshot of your character's collision details?

Here is an image of the option I'm referring to. Ensure that the box highlighted in red is checked:

alt text

hitevents.png (61.2 kB)
avatar image CornKrue Jan 28 '16 at 03:36 PM

Hi,

Thank you for your help, I checked the respective box but without an effect.

See here my collision details:

alt text

avatar image Sean L ♦♦ STAFF Jan 28 '16 at 03:47 PM

So you say your cast is never executing. Is the Print String node firing? It could be that for some reason your Touch event is never firing off.

avatar image CornKrue Jan 28 '16 at 03:57 PM

If I touch somewhere nearby the character the Cast Failed and the following print statement is working as well - so the touch event seems to work properly. Only if I hit the character nothing happens.

avatar image Sean L ♦♦ STAFF Jan 28 '16 at 06:14 PM

I've put together a simple test that I have working. Here is the blueprint:

alt text

Instead of using Get Hit Result by channel, I used for Object and looked for any objects of the Pawn type. This cast succeeded when I was mousing over my character, and failed when I was not. Would something like this work for you? If not, I can continue to investigate your issue.

hitresult.png (150.7 kB)
avatar image CornKrue Jan 28 '16 at 10:01 PM

I also tried "for object" but still no change. Find below the collision details for the Capsule Component (Inherited) and the mesh of my character. Maybe there is something wrong.

Obviously the character is not recognized as character or as clickable object. I guess that is why the cast is neither working nor failing - it just seems to get no input from break hit result.

alt text

alt text

avatar image Sean L ♦♦ STAFF Feb 04 '16 at 08:26 PM

I apologize for the delay. Could you please zip up your project and provide a link to Dropbox where I can download it? I'd like to look further into your setup to determine why the solution I suggested isn't working on your end, as I've tested it a few times on my end and it has succeeded every time so far. Thank you.

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

1 answer: sort voted first

im guessing its one of two things. 1. Top Down Character is not the name of your characters blueprint class, a common mistake i make when using assets from other projects, 2. your collision presets are whats causing it. Event hit is for blocking, overlap events are for overlapping, set your players blueprint to block all and i think this should work

more ▼

answered Feb 04 '16 at 08:52 PM

avatar image

ViceVersa
1k 64 47 98

(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