寻找逃跑的渡渡鸟的角度
我希望我的小动物 AI 在玩家踢它时直接跑离玩家,但我不知道计算该角度的数学或语法。他们是两个在世界空间中独立移动的角色。
这是我到目前为止得到的结果:
waypoint = (fleeWP.transform.position);
transform.LookAt(Vector3(waypoint.x, transform.position.y, waypoint.z));
transform.Translate (Vector3.forward * speed * Time.deltaTime);
目前这使得小动物朝路径点移动,而不是离开。我可能攻击这一切都是错误的。请惩罚我。
I want my critter AI to run directly away from the player when the player kicks it, and I don't know the math nor the syntax to calculate that angle. They are two characters moving independently through worldspace.
Here is what I got so far:
waypoint = (fleeWP.transform.position);
transform.LookAt(Vector3(waypoint.x, transform.position.y, waypoint.z));
transform.Translate (Vector3.forward * speed * Time.deltaTime);
This currently makes the critter move towards the waypoint, rather than away. I might be attacking this all wrong. Please chastise me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需颠倒翻译即可:
Just invert the translation: