Reflect
Use Reflect to get the reflection vector of an input vector on a surface. Supported types: Vec2 and Vec3. Reflect is in the Transform category.
Input
Name | Data Type | Description |
---|---|---|
Direction | Vec2 | The origin vector to calculate the reflection vector for. |
Normal | Vec2 | The normal vector of the reflection surface. |
Output
Name | Data Type | Description |
---|---|---|
Result | Vec2 | The reflection vector of A. |
Example
![reflect example](http://lf16-tiktok-common.tiktokcdn-us.com/obj/tiktok-web-common-tx/effect/learn/assets/images/reflect_example-2af1812b0ed7a55e89f048d286ad4863.gif)
This example has a checkerboard placeholder 2D object initialized to the center of the screen. It maintains a variable called “speed”, and initializes that with value (12, -1). It updates the speed value if the position of the checkerboard goes beyond the vertical boundary of the screen by using the Reflect node.
![reflect node](http://lf16-tiktok-common.tiktokcdn-us.com/obj/tiktok-web-common-tx/effect/learn/assets/images/reflect_node-b1b95e67c064c0c70c61674c84cf2c8f.png)