Announcement

Collapse
No announcement yet.

How to highlight a given component in C++ with raycasting?

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

    How to highlight a given component in C++ with raycasting?

    Hi all,

    As the title says, I'm trying to figure out how to highlight a Static Mesh component when the raycast hits it.

    #2
    Create a material for the outline.

    https://www.tomlooman.com/multi-colo...real-engine-4/

    Use a post process volume, set it to unbound and give it the material. When the raycast hits the object, set the static mesh component -> render custom depth to true.
    Last edited by JoSf; 05-18-2019, 06:02 AM.

    Comment


      #3
      Originally posted by JoSf View Post
      Create a material for the outline.

      https://www.tomlooman.com/multi-colo...real-engine-4/

      Use a post process volume, set it to unbound and give it the material. When the raycast hits the object, set the static mesh component -> render custom depth to true.
      Thank you for your answer. But my actor have a few UStaticMeshComponents. So I created a different class for this specific UStaticMeshComponent and I wish my raycast detects this specific StaticMesh Component only (by my custom class). Not other UStaticMeshComponents. Should I use raycasting by channel if I set this one component to a different channel?

      Comment


        #4
        I assume C++ since you are using prefixes.

        Linetraces return a struct FHitResult.

        http://api.unrealengine.com/INT/API/...ne/FHitResult/

        From the FHitResult you can get the Component and see if it was the component you wanted to check for.

        Comment


          #5
          Originally posted by JoSf View Post
          I assume C++ since you are using prefixes.

          Linetraces return a struct FHitResult.

          http://api.unrealengine.com/INT/API/...ne/FHitResult/

          From the FHitResult you can get the Component and see if it was the component you wanted to check for.
          Ok, thank you for your precious help.

          Comment

          Working...
          X