统一代码如何使障碍跟随玩家

编程入门 行业动态 更新时间:2024-10-17 02:55:45
本文介绍了统一代码如何使障碍跟随玩家的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当玩家触摸障碍物的延伸对撞机时,玩家应该跟着障碍物(我的游戏中的蜘蛛)。我做了障碍物(蜘蛛)给动画师的动作手势而我写了代码但是障碍物没有跟随或 朝着方向移动。它只是显示当玩家与障碍物的碰撞器发生碰撞时的动作(腿部动作)手势。 我尝试了什么: 我试过这个代码并且坏了。请帮我查看障碍物对撞机的代码。

The player should be followed by the obstacle(spider in my game) when the player touches the extended collider of the obstacle.I made the obstacle(spider) to give the movement gestures in animator and I wrote the code but the obstacle is not following or moving in direction .It just showing the movement (leg movements)gestures when the player collides with collider of the obstacle. What I have tried: I tried the code and got broken.Please help me with the code for the obstacle collider.

推荐答案

获取玩家的位置,并在下一次更新过程中更新蜘蛛相对于玩家的位置(即改变玩家的x,y,z) spider的变换组件靠近玩家的(变换)位置。) Get the position of the player, and update the position of the spider relative to the player on the next update pass (i.e. change the x, y, z of the spider's Transform component to move closer to the player's (Transform) position).

更多推荐

统一代码如何使障碍跟随玩家

本文发布于:2023-11-17 02:37:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1608499.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:障碍   代码   玩家

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!