Angle Between
![angle between](http://lf16-tiktok-common.tiktokcdn-us.com/obj/tiktok-web-common-tx/effect/learn/assets/images/angle_between-aab4de05f2ed842038a47230ff1784c4.png)
Use Angle Between to calculate the angle between two vectors. Supported types: Vec2 and Vec3. Angle Between is in the Transform category.
Input
Name | Data Type | Description |
---|---|---|
A | Vec2 | The first vector. |
B | Vec2 | The second vector. |
Output
Name | Data Type | Description |
---|---|---|
Result | Number | The acute angle between the two input vectors in radians. |
Example
![angle between example](http://lf16-tiktok-common.tiktokcdn-us.com/obj/tiktok-web-common-tx/effect/learn/assets/images/angle_between_example-60a8b58d67a5c6644a6190752ef47796.gif)
This example shows how to use Angle Between to detect if the ray from the camera is hitting the sphere within the 5 degrees. If it is, the sphere will turn red.
![camera ray](http://lf16-tiktok-common.tiktokcdn-us.com/obj/tiktok-web-common-tx/effect/learn/assets/images/camera_ray-d5283c030b1741002627701540d85fec.png)
![angle between node](http://lf16-tiktok-common.tiktokcdn-us.com/obj/tiktok-web-common-tx/effect/learn/assets/images/angle_between_node-39aea36ac4c6985d821d35a6ec07292f.png)