Given a 3D vector, can you get the X coordinate without using 3D Vector to Scalar or any other conversion node? (Not that there’s anything wrong with using a conversion node.)
Hint: ||A||*||B||*adjacent/hypotenuse
Answer
Given a 3D vector, can you get the X coordinate without using 3D Vector to Scalar or any other conversion node? (Not that there’s anything wrong with using a conversion node.)
Hint: ||A||*||B||*adjacent/hypotenuse
Answer
The docs don’t say whether the Trigonometry nodes like Cos and Sin work with degrees or radians, so you have to figure it out yourself. Fortunately, that’s pretty easy to do. You just check which of these returns -1: cos( 180 ) or cos( π) ?
I went a little overboard, but this shows that Cos and Sin expect angular measurements expressed in degrees.
This is based on some basic trigonometry, which can be pretty handy when working with ICE:
Dealing with particle orientation and rotation can be frustrating, especially when you’re first learning.
Here, I’ve got a bunch of faces instanced onto a disc, and I want all of them to to look the closest point on the grid that’s in the center of the disc. Because the initial local Z axis of some particles faces “away” from the grid, you get can some weird popping and flipping. Here’s an illustration of the problem from an earlier test, when I was aligning the faces to look at a specific point. Notice how only the instances on one side of the null have problems.
So, I use the dot product to determine whether the local Z axis faces “away” from the target grid, and if so, I make an adjustment of 180 degrees, and then the faces align nicely.
A negative dot product tells me that the angle between the local Z axis and the vector to the closest point on the grid is more than 90 and less than 270.
Taking a cluster of points and moving them on to a circle turned it to be easier than I thought… At first it seemed more complicated to get at the points, because sometimes the Show Values on the output of a Filter node is, let’s face it, misleading. Based on what a certain Show Values showed me, I started off using arrays instead of Filters, and that made the graph a little messier.
First, I calculate the point I want to use as the center of the circle. That gives me the first vector I need.
Subtracting the CC (circle center) vector from the PP (Point Position) vectors gives me a set of vectors that take me from the circle center to the points.
I just resize the PP-CC vectors to get point positions that fit on a circle:
Circles, spheres, and radii…
For a couple of reasons, I was playing around a bit with spherifying/circulizing this weekend:
Based on this basic idea: “every point on a sphere/circle is the same distance from the center”, I was able to rough-out a couple of ICE trees:
Creating a circle on the surface of a mesh required just a little bit of 3d vector math. Here’s a little video that goes over using vector subtraction to move a point onto a circle. I spent more time setting up the “Show Values” in my demo then I did recording the thing.