搜麒麟子大佬有些过。。
这种不行,我一开始实现的就是这样的,直线追踪,没有弧度
我为此做过一个教程,因为我之前是开发塔防的需要用到跟踪导弹
https://www.bilibili.com/video/BV1FE411G7wg/?spm_id_from=333.999.0.0
不过视频做的比较菜,如果有意的话可以看看。
不知道是不是你想要的效果
很久之前录的了。。
1赞
不要每帧直接把角度设置为自己与目标的方向,角度变化有个速度,比如说每秒修正10度,这样表现出来的应该就不会是直线了
在弧度计算上,用lerp加一个线性插值不久行了?
let radian = Math.atan2(direct.y, direct.x) - cc.math.lerp(偏移弧度, 0, 执行时长 / 总时长);
比如:
this._lifeStamp += dt;
let radian = Math.atan2(direct.y, direct.x) - cc.math.lerp(this._angularSpeed, 0, this._lifeStamp / this._lifeTime);
这也没有办法知道执行时长

不是这种弧线追踪吗?
差不多了,很相似了,请问你是怎么实现的,我是飞机是实时的不知道具体执行时间

这个我研究了好久,始终没有明白
我重新编辑了下, 之前可能有点绕。
![]()
lerp里的参数可以根据自己想要的效果调整
1赞
哈哈哈哈,我研究出来一点味道了
改变节点的角度即可,也不难实现
你这是什么插件,参数名也能显示出来

应该是这个
1赞
大佬,这个视频里的效果你用cocos creator有做出来吗,我现在也想实现这种效果
实现了,多少有些不一样
有没有代码参考一下
Vec3.subtract(this.dir, this.enemy.position, this.node.position)
this.node.angle = math.toDegree(Math.atan2(this.dir.y, this.dir.x)) - 90
Quat.fromAxisAngle(this.node.rotation, Vec3.UNIT_Z, Math.atan2(this.dir.y, this.dir.x) - 1.5)
Quat.fromEuler(this.quat, 0, 0, this.rotationAngle)
Quat.multiply(this.node.rotation, this.node.rotation, this.quat)
Vec3.multiplyScalar(this.trans, this.direction, this.speed * dt)
this.node.translate(this.trans)
angle我测试赋值就行,什么值都行
1.5 这个就是调节作用的
如果你实现的效果好,请告诉我
