Line trace to change material then revert back

I’m struggling to get the original material and then being able to change it after I stop looking at the object.
Thanks.

You can do the line trace from your view point to check if it’s hit the object and just set the required material if state is changed (you can store the “looking at” state somehow – either in a bool variable if you have a single object to check or the actor’s reference to check if it’s the same object).

Hello!

  1. Create SightInteraction_Interface add SightState_Function in it with Bool input variable IsPlayerLookingAtMe?

  1. Create SightReaction_BP add StaticMesh_Component and in ClassDetails implement SightInteraction_Interface. Now implement SightState_Event to drive Material of your StaticMesh_Component.

  1. In FirstPersonCharacter_BP implement TraceByChannel to check what Actor you see currently You need DefaultSightActor and NewSightActor variables. Set your Trace distance factor. Now call SightState_Event alternating bool IsPlayerLookingAtMe? to change Material (actually do any things)

  1. You can check if Actor does implement interface before send InterfaceMessage at all… and check if IsValid? and etc…
    GLHF

depending what you’re doing, you may not even need to linetrace or use a blueprint. you have access to the camera direction in the material so you can just change the parameters of the material when you’re looking at it.

Edit: object position may be better than using actor position.

Hey thanks but I’m having trouble with your answer, it doesn’t seem to change material at all. Not sure what to do.

Thank you, this worked but I don’t think I’d be able to utilise it for the my required function.