We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Change material on Hover Event

Home Forums Graphics / Blender Change material on Hover Event

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #61360
    tughuart
    Participant

    Hey everyone!

    I’m working on an experiment as part of my assignment. I have a block skeleton, and I’m trying to have each part of the model highlighted in blue when the mouse hovers over it and then goes back to its default colour when hovering out.

    My approach was to assign a texture to the default ‘Principled BSDF’ material in Blender and then assign it to the ‘Torso’. In puzzles, I created the ‘When hovered’ event, to change the texture map assigned to the material from Blue.jpg when ‘Over’to White.jpg when ‘Out’.

    My challenge is if I assign the same material to all parts of the skeleton, they would all update at the same time regardless of whichever part I hover on. What is the best way to create a hover effect for each part of the mesh without having to create new materials for each of the parts of the skeleton? Is there a way to use puzzles to create a hover effect for each part with the same material?

    Thank you.

    #61361
    kdv
    Participant

    No, there is no such a puzzle. Objects are selected by their names. Parts of a single-material object have no names.

    A single-material mesh

    A multi-material mesh

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #61364
    kdv
    Participant

    It’s a little tricky task ))) First, you should split your mesh into several parts

    Then you should use raycasting to detect the hovered sub-mesh.
    https://www.soft8soft.com/docs/api/en/core/Raycaster.html

    As a result you can get something like this
    https://v3d.net/gfe

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #61432
    tughuart
    Participant

    Thanks so much for this. It really was helpful. I decided to go with the hover effects built into Puzzles already.

    But with this, I’ll be able to use this feature in future projects.

    Thanks again

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.