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 doesn't work

Hello guys, I'm new in UE4, and I'm having a little trouble with my movement and mouse inputs. So I'm following a tutorial and I'm having a Controller that is receiving the inputs and updating their variables, but when I use cast to get the variables in my AnimBP class they're 0. I've tried printing the variables and got 0. Below you can see my code.

Thank you in advance, GhoSTBGcode1

code2

Product Version: UE 4.15
Tags:
more ▼

asked Apr 10 '17 at 10:54 PM in Blueprint Scripting

avatar image

GhoSTBG
6 2 2

avatar image Benergy Apr 11 '17 at 02:00 PM

Perhaps a silly question, but does your game use your custom player controller?

avatar image GhoSTBG Apr 11 '17 at 02:57 PM

Yes, I'm using my custom gamemode with my custom player controller, character etc.

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

2 answers: sort voted first

Your Player Controller only exist if you start the Game. Click Play come back to this Window and in the upper toolbar you See Filter. Choose your Character there and it will show up properly.

https://gyazo.com/d2b864ee75062e1936cab75919270210

more ▼

answered Apr 11 '17 at 12:11 AM

avatar image

Nachtmahr
7k 143 28 172

avatar image GhoSTBG Apr 11 '17 at 05:56 AM

My problem is that the AnimBP doesn't receive my input and my character cannot move, even can't rotate the mouse. I don't know what's the problem. Also, in project settings / input I've added the needed values, but it's same.

avatar image Benergy Apr 11 '17 at 04:00 PM

Rotating the mouse is actually not a responsibility of the AnimBP. You need to set "Use Pawn Control Rotation" to true in your character BP's spring arm details. And moving your character isn't done in the AnimBP either. Link your input axis to "Add Movement Input" in your characters BP.

avatar image GhoSTBG Apr 11 '17 at 09:38 PM

I don't have any code in my Character BP, only in the player controller and the AnimBP.

avatar image Benergy Apr 12 '17 at 08:08 AM

Then in your player controller, something like this should do the job: alt text

If you want your character to orient towards movement, then go to the details tab of your character movement component and check "Orient rotation to movement"

screenshot.png (90.6 kB)
avatar image GhoSTBG Apr 12 '17 at 10:00 AM

My character is still not moving :x screenshot4screenshot3screenshot2screenshot1

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

You need to have an isvalid node in there to prevent that from happening.

more ▼

answered Apr 11 '17 at 01:45 PM

avatar image

MrGoatsy
604 34 26 45

avatar image GhoSTBG Apr 11 '17 at 03:00 PM

Can you explain it better? I can't understand I'm still new in UE4?

avatar image MrGoatsy Apr 11 '17 at 04:20 PM

Take a look at this:

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Utilities/IsValid/index.html

You need to hook the get player controller to that node, then if it is valid do the cast, also hook the get player controller to that node.

Please mark this as answered if this helped you.

avatar image GhoSTBG Apr 11 '17 at 09:38 PM

Nope, doesn't work.

(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