本文介绍了Unity-如何使用Vector2.Reflect()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我到处都看过,包括Unity文档,但似乎找不到如何使用Unity的Vector2.Reflect()函数的任何好例子.我试图用它来控制球碰到墙壁时的方向(在2D Breakout游戏中).它需要2个参数(inDirection,inNormal),但是我似乎无法弄清楚如何使用它.任何帮助将不胜感激.
I have looked everywhere including the Unity documentation but cannot seem to find any good examples of how to use Unity's Vector2.Reflect() function. I am trying to use this to control the direction of the ball (in a 2D Breakout game) when it hits a wall. It takes 2 arguments (inDirection, inNormal) but I cannot seem to figure out how to use this. Any help would be appreciated.
推荐答案
Vector2 Reflect(Vector2 inDirection, Vector2 inNormal)
:
inDirection
:黑色箭头
inNormal
:红色箭头
return output
:绿色箭头
这篇关于Unity-如何使用Vector2.Reflect()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!