[LayaAir 2.0] Laya.Quaternion.rotationLookAt 怀疑存在BUG
代码的内容就是相机望向一个坐标点,
Laya.Quaternion.rotationLookAt 的 结果是错误的
LAYA版本
RoundCamera_Laya(zhujue: Laya.Vector3, enimy: Laya.Vector3, ca: Laya.Transform3D) {
var enimyPos = enimy;
enimyPos.y = 0;
var cameraPos = ca.position;
cameraPos.y = 0;
var enimy2cameradir = JieTools.subVec3(enimyPos, cameraPos);
Laya.Vector3.normalize(enimy2cameradir, enimy2cameradir);
var outQua = new Laya.Quaternion();
Laya.Quaternion.rotationLookAt(enimy2cameradir, Laya.Vector3._Up, outQua);
ca.rotation = outQua;
}
UNITY版本
void RoundCamera_U3D(Vector3 zhujue, Vector3 enimy, Transform ca)
{
var enimyPos = enimy;
enimyPos.y = 0;
var cameraPos = ca.position;
cameraPos.y = 0;
var enimy2cameradir = JieTools.subVec3(enimyPos, cameraPos);
enimy2cameradir.Normalize();
var outQua=Quaternion.LookRotation(enimy2cameradir, Vector3.up);
ca.rotation = outQua;
}
Laya.Quaternion.rotationLookAt 的 结果是错误的
LAYA版本
RoundCamera_Laya(zhujue: Laya.Vector3, enimy: Laya.Vector3, ca: Laya.Transform3D) {
var enimyPos = enimy;
enimyPos.y = 0;
var cameraPos = ca.position;
cameraPos.y = 0;
var enimy2cameradir = JieTools.subVec3(enimyPos, cameraPos);
Laya.Vector3.normalize(enimy2cameradir, enimy2cameradir);
var outQua = new Laya.Quaternion();
Laya.Quaternion.rotationLookAt(enimy2cameradir, Laya.Vector3._Up, outQua);
ca.rotation = outQua;
}
UNITY版本
void RoundCamera_U3D(Vector3 zhujue, Vector3 enimy, Transform ca)
{
var enimyPos = enimy;
enimyPos.y = 0;
var cameraPos = ca.position;
cameraPos.y = 0;
var enimy2cameradir = JieTools.subVec3(enimyPos, cameraPos);
enimy2cameradir.Normalize();
var outQua=Quaternion.LookRotation(enimy2cameradir, Vector3.up);
ca.rotation = outQua;
}
没有找到相关结果
已邀请:
要回复问题请先登录
0 个回复