Announcement

Collapse
No announcement yet.

OnClick event won't trigger on reference from scene object. (Pretty pics included)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    OnClick event won't trigger on reference from scene object. (Pretty pics included)

    Hi guys, I tried everything, google'd everything, but I can't find a solution.

    So this is what I want to achieve:

    I have a blueprint that contains a sphere that I can click on. I have 3 public static mesh variables, that are public. I have 3 static mesh spheres in the scene that I can put in my blueprint object.
    I click on the glass sphere and it unhides the 3 material spheres. They are referenced in the blueprint because they're public. I now want to be able to click on one of the 3 material spheres to change the material on the chair.
    Changing the material works, and it gets picked from the sphere and assigned on the chair, that works. I just can't make the mouseclick work on one of the 3 spheres.

    Thank you for reading and I hope the pictures are clear.

    Click image for larger version

Name:	JBTxSuB.jpg
Views:	1
Size:	238.8 KB
ID:	1137988
    Click image for larger version

Name:	blueprintnodes.png
Views:	1
Size:	384.1 KB
ID:	1137987

    #2
    Does your static mesh has collision shapes?
    Make sure on hit/touch events are enabled in player controller, and the raycast channel is setting according to static mesh settings.
    Alone: The Untold - a story driven horror game

    Comment


      #3
      Yes, everything should be setup fine. Hit events are enabled, and the collision channel is set to block all.

      Comment


        #4
        eh...you are using the bind event wrong.
        I wish there are simpler way to describe, but be patient.
        1. "Bind Event to OnClicked" node's input execution line should be after "EventBeginPlay" before "ToggleVisibility", so it only run once.
        2. "Bind event to OnClicked" target can be what you have right now, but later you need a way to rebind target for different material ball.
        3. "OnClicked_Event"'s output execution pin are suppose to connect to the "SetMaterial"'s input execution pin.

        And finally, this is kinda bad way to do things all in one place, because you would have duplicate efforts for many binding and event for each sphere ball at the end.
        to make it better try this.
        1. make a blueprint for your clear sphere so it does the following.
        - have an array for material ball blueprint, make sure it's editable and expose on spawn.
        - have click event to toggle all material ball's visibility by using loop
        - during event begin play, set the objToChangeMaterial and pass them to all material ball in array
        2. make a material ball blueprint, and have following function/event
        - an event to accept a input component/object to change material
        - click event to apply your material on the saved reference component/object

        After done all that, you can create your material ball and assign to your master clear ball in editor, hit play and everything should be good.
        And no weird wiring.
        Unreal Engine 4 Game Framework diagram for relation of all major base object types
        Unreal Engine 4 Input Event diagram, scroll down to section Input Processing Procedural
        Resident Evil Classic Camera
        RPCs official document, Must Read
        Everything you should know about replication

        Comment


          #5
          Thanks PenguinTD! I'm pretty new to this (duh), I'll try that! Thank you for your time and your suggestion of the clean way to set that up

          Comment

          Working...
          X