No announcement yet.


  • Filter
  • Time
  • Show
Clear All
new posts


    Could anyone please explain what should go into this cast object node.

    Click image for larger version

Name:	Untitled.png
Views:	1
Size:	313.0 KB
ID:	1170099

    Im just trying to call this variable and if true when i press e i want it to open my crafting menu widget.

    Click image for larger version

Name:	Untitled2.png
Views:	1
Size:	212.5 KB
ID:	1170098

    This object node is really confusing me.
    Attached Files
    Last edited by viggerz; 01-12-2016, 02:42 PM.

    Its ok ive got it, it was actor traced again


      Originally posted by viggerz View Post
      Its ok ive got it, it was actor traced again
      Hey, although you got it by yourself, i have the feeling that you don't really understand WHY.

      So let me give you a really small example based on your picture above:

      So when pressing "E", you want to check, if the "Workbench" in front of you has "IsPlayerInCraftingZone" true or false.
      So first of all you need a general reference to the Actor. A reference, and that is important, can be empty/null. And with reference
      i mean every light blue pin and node. So if you create a variable of type "Workbench", this variable is only a container to hold
      a reference of a workbench. For example the one in front of you.

      But how do you get this reference inside the variable (or inside the Cast Node you got in your screenshot)?

      Well you could have overlaps going on and the "OtherActor" in the Overlap Event that might exist inside of your Character COULD be the Workbench.
      Or, and that's how you did it, you can Line Trace the Actor in front of you.

      But the line trace won't directly return a Workbench. It will return an "Actor" class. Actor is the top most class if it comes to 3D placable things in your scene.
      So how to tell if the Actor you traced there really is the workbench? Well that's what the case is for. If you cast something to workbench which is not of this class
      (or a child of that class), the cast will simply fail!

      So by tracing and then casting, you make sure that the Actor you traced is a workbench.

      ALSO: Casting is needed if you want specific variables of this class. The line traced actor might be the Workbench, but without casting it is just an Actor and you can't
      get the bool variable from it. So casting also enables you to access the variables and functions in it.
      This is similar to you being a human in general, but you could "cast" yourself to "viggerz" which would give options to your birthdate etc.

      I hope that makes sense xD
      Open for contracted work | C++/BP (incl. Multiplayer) | Tutoring | VR

      My UE4 Blog/Page with Tutorials and more: Hit me for ALL the things!
      (Including 100+ Pages Multiplayer Network Compendium to get you started.)