Having issues here aswell. The idea for my needs is i need to add highlight when i mouse over.
I got methods to detect mouse_over over an object (collider) then i get its mesh and then do stuff to the mesh.
THe problem im facing i dont understand why this not working.
func highlight_object(collider, is_mouse_entered:bool):
if collider is Item:
var mesh = collider.item_mesh
var material_count = mesh.get_surface_override_material_count()
for i in range(material_count):
var mat = mesh.get_active_material(i)
if is_mouse_entered:
var new_mat = mat.duplicate()
new_mat.next_pass = HIGH_LIGHT
mesh.set_surface_override_material(i,new_mat)
else:
mat.next_pass = null
I got two types of items
Hat
Potion
In the world i have these two scenes and duplicated them in the world tree.
As you can see in the video the potion item works fine, i can highlight each of the items separately but the hats are wierd. One highlights the other.
EDIT:
I just realized that i CTRL + D in the world tree to duplicate the Hat scene, and thats why.
Even if i set to local:
func highlight_object(collider, is_mouse_entered:bool):
if collider is Item:
var mesh = collider.item_mesh
var material_count = mesh.get_surface_override_material_count()
for i in range(material_count):
var mat = mesh.get_active_material(i)
if is_mouse_entered:
var new_mat:Material = mat.duplicate()
new_mat.next_pass = HIGH_LIGHT
new_mat.resource_local_to_scene = true
mesh.set_surface_override_material(i,new_mat)
else:
mat.next_pass = null
Same result.
Also tried to check the
Not helping