This commit is contained in:
2024-09-20 17:13:16 +08:00
parent 4baee558c5
commit 96c96da552
8 changed files with 146 additions and 46 deletions

View File

@@ -57,13 +57,15 @@ export class SkillCom extends CCComp {
if(this.run_type == 0){ //直线,默认直线,有特定目标 朝向目标直线
let time = 720 / this.speed;
let squaredDistance = this.t_pos.x * this.t_pos.x + this.t_pos.y * this.t_pos.y;
let distance = Math.sqrt(squaredDistance);
time = distance / this.speed;
let e_pos=v3(this.node.position.x+this.t_pos.x,this.node.position.y+this.t_pos.y)
tween(this.node).to( time,{ angle:this.angle,position: e_pos},
this.node.getChildByName("skill").setRotationFromEuler(0,0,this.angle)
console.log("skill ",this.node.getRotation())
tween(this.node).to( time,{ position: e_pos},
{
easing: "linear",
onUpdate: (target: Vec3, ratio: number) => { },