c# - Unity - 如何使用 Vector2.Reflect()

标签 c# unity3d vector pong breakout

我到处都看过,包括 Unity 文档,但似乎找不到任何关于如何使用 Unity 的 Vector2.Reflect() 函数的好例子。当球撞到墙上时,我试图用它来控制球的方向(在 2D Breakout 游戏中)。它需要 2 个参数(inDirection,inNormal),但我似乎无法弄清楚如何使用它。任何帮助将不胜感激。

最佳答案

enter image description here

Vector2 Reflect(Vector2 inDirection,Vector2 inNormal):

inDirection:黑色箭头

inNormal:红色箭头

返回输出:绿色箭头

关于c# - Unity - 如何使用 Vector2.Reflect(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41129573/

相关文章:

c# - 使用 XmlMessageFormater 序列化的消息拒绝反序列化 List<T> 成员

c# - Webbrowser尝试解析一些使用ajax加载数据的页面

unity3d - 统一 3D : what is the correct way to detect that the collision has already been processed for another collision participant?

c++ - 从 vector 中删除自定义对象

c# - 如何查找 native DLL 文件是编译为 x64 还是 x86?

C# AddMemoryPressure 性能

c# - Unity3d 沿平面移动对象(仅限 X 和 Z 轴)

unity3d - 在cueBall与unity3d中的任何球碰撞后如何获得方向?

c++ - 在多个 vector 的组合上实现迭代器

C++访问 vector 的一定范围的索引