[0]计算反弹角度,反弹速度

onTriggerEnter碰撞后怎么计算反弹角度,反弹速度
已邀请:

小小泽

赞同来自:

我们之所以使用物理引擎,是希望物理引擎把这些计算都做了。我们也不知道这是怎么计算的。

黑不黑

赞同来自:

作为一个游戏引擎 这些常用的物理碰撞计算应该提供api的

黑不黑

赞同来自:

我是通过触发trigger时    子弹发射射线 检测墙实现的,  大概代码:
 let from = this.owner.transform.position;
let dir = new Laya.Vector3(this.dir.x, 0, this.dir.y);
let ray = new Laya.Ray(from, dir);
let HitResult = new Laya.HitResult();
let nv3;
scene.physicsSimulation.rayCast(ray, HitResult, 3, Consts.Coll_Bullet, Consts.Coll_Other);
            if (HitResult.collider) {
                nv3 = HitResult.normal;
                nv3.y = 0;
                let mid = 2 * Laya.Vector3.dot(dir, nv3);
                Laya.Vector3.scale(nv3, mid, nv3);
                Laya.Vector3.subtract(dir, nv3, dir);
                console.log("反弹方向:",dir);
}

要回复问题请先

商务合作
商务合作