Dot
![dot](http://lf16-tiktok-common.tiktokcdn-us.com/obj/tiktok-web-common-tx/effect/learn/assets/images/dot-1ebb23f6437a84a17b2a39345b10c110.png)
Use Dot to calculate the dot product between two vectors. For example, the dot product of vector A [1, -3, -2] and B [5, -1, 1] is:[1, -3, -2] · [5, -1, 1] = (1 x 5) + (-3 x -1) + (-2 x 1) = 6Supported types: Vec2, Vec3, and Vec4. Dot is in the Math category.
Input
Name | Data Type | Description |
---|---|---|
A | Vec4 | The first vector. |
B | Vec4 | The second vector. |
Output
Name | Data Type | Description |
---|---|---|
Result | Vec4 | The result of the cross product. |
Example
![dot example](https://sf16-va.tiktokcdn.com/obj/eden-va2/vhreh7flszld/large_assets/dot_example.gif)
The cube’s rotation is controlled by the position of the sphere. This example uses vector to calculate the angle between sphere position and unit vector along X-Axis. Then it applies this angle for the cube’s rotation.
![dot node](http://lf16-tiktok-common.tiktokcdn-us.com/obj/tiktok-web-common-tx/effect/learn/assets/images/dot_node-575018d313bd28f3d28916630590bde9.png)