- Home /
highlight cube sides on mouse hover
hi how would i code (in c#) so a side of a cube is highlighted when a mouse hovers over. i need it to update so whichever side of the cube i point at with the mouse, it highlights. i can already make the cube highlight on mouse pointing but not the sides. thanks
Answer by Berenger · Jun 19, 2012 at 03:53 PM
By sides you mean faces I assume. That's not going to be an easy one. You need to either have an emissive shader depending on a mask, a set of 7 mask (each faces and no faces) and a way to find which texture correspond to which face.
Or, when you found the face, create a new object with a mesh plane the size of your cube faces and display it above the selected face, with the highlight material.
To find the face, you'll have to use the info inside RaycastHit.
Answer by QFord · May 30, 2016 at 05:25 AM
Just use highlighting-system plugin. https://www.assetstore.unity3d.com/cn/#!/content/41508