VFX Graph Set Angle From Map not working

I was trying to get a group of pyramids to spawn around a point cache and to use the normals of the point cache to set their rotation facing the shape. But Set Angle From Map doesn't seem to do anything.

I used set color from map (with the normal map) to confirm that the normals were correctly recorded.

5029022--492866--Screenshot_3.png 5029022--492860--Screenshot_1.png 5029022--492863--Screenshot_2.png

Using Unity 2019.1.7f1

I guess normal is not supposed to be euler angles right ? You should rather use set Axis Z instead of Angle XYZ, ans use custom orientation in output to derive the two other axis from axis Z

Thanks for your answer. Ok, so, I understand that the normal is not the rotation value I should use, it's just the direction I want my objects to face. That was an obvious mistake.

I didn't quite get what you suggested, though. I think what you mean is I should translate my direction vector (given by the normals) to the final desired euler angles? I looked up the conversion math to do so but it seems to require the use of atan2, which isn't implemented yet (and neither is arctan, which I could use to implement it myself as a subgraph, at least). Was this what you meant or am I still missing something?

You can try

1) add "Set Direction from map" in initialize state.
2) Set the point cache normal to the "Attribute Map" in "Set Direction from map".
2) add "Set Target Position" in initialize state - which is the sum of "Get Attribute : direction" and "Get Attribute : position".
3) Add "Connect Target" in Output state.
4) Set "Get Attribute : target position" to "Target Position" in "Connect Target".
5) Add "Set Scale.XYZ" to Output state and set the scale to 1, or any other value that suits your case.

6408417--715482--1.png 6408417--715485--2.png


Great tip @mkyip ... This got me about 95% the way there, but there is a minor bug. Instead of Adding the Direction and Position vectors, use a Cross Product.

Here is some particles with a Debug Texture mapping nice and flat to the curvature of the sphere. You can then modify the Value Bias on the Set Direction Block to flatten the particles to the surface, eg, Value Bias Z = 90



1 Like

I would be interested in seeing how you got that working. I tried to replicate that technique and it wasn't working out quite right. Is there any chance you could post an image of your vfx graph that produced that wrapped sphere?