Object becomes more opaque when cursor is closer

To put it simply, I’m trying to make Object B become more opaque when the cursor hovers over Object A. I figured out how to make Object B become less opaque when hovering over Object A, but I can’t figure out how to reverse that. The answer is probably really simple, but I can’t figure it out. Does anyone know?

Try with opacity

If cursor is over Object set Object opacity = 125

Invert condition
if cursor is over Object opacity = 255


hover_edit_0

Hmm… a few ways I could see you doing this.

In my mind, the easiest way:

  1. Either have a custom cursor object, OR just have a object that is hidden at the start of the scene but is positioned to follow the cursor.
  2. Decide on the distance you want to start fading in the object. (Let’s say 200 for now)
  3. Compare the distance between your object and the customcursor/hidden object as the condition. (There is a “Compare the distance of two objects” condition)
  4. Use the “Change the opacity” action, and for the value, use 255 - ((ButtonNameHere.Distance(CustomCursor) / 200) * 255)

You can adjust the distance in both the condition and in the formula as needed.

I just thought of a really simple solution: make the opacity 255 - distance between cursor and object A. I wanted it to be dynamic, so that’s why I didn’t go with Ulises’ suggestion. I tried out the solution and it works great, minus a few adjustments. This is similar to what Silver-Streak suggested, thanks for the suggestions! (I did know about the distance compare condition)