Hi,
does anyone know how to do that => If the character looks in the middle (-10 to 10 degrees) of an object, the object’s color should change.
Hi,
does anyone know how to do that => If the character looks in the middle (-10 to 10 degrees) of an object, the object’s color should change.
Dot Product
look direction & the direction to the object. Dot goes from -1 <-> 1, use ACOSd
to work with degrees if that’s more convenient. When you hit the desired threshold either switch materials or use a dynamic material instance to adjust the color.
To make both of the solutions above work, the pivot points of both objects need to be in the center…
I did it, but still not the desired result. The color should change when the arrowhead of the character points to the center of the object.
What is not working? I mean, you need script for the material change:
Or a dynamic material instance. This can be set up better so we do not spam the whole thing on Tick, ofc.
Would this also work in “ThirdPerson” version? You use camera and not arrow. I want the color to change when the character looks at the center of the object. The camera shouldn’t have any effect.
Yes, it will work with anything. Use the arrow’s location and forward.
thank you very much, worked very well!