Sandy 2019-12-18 22:20:07 +09:00 committed by GitHub
parent 4d54f6d2dc
commit 64a18db096
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@ import iron.math.Quat;
class LookAtNode extends LogicNode {
public var property0:String;
var v1 = new Vec4();
var v2 = new Vec4();
var q = new Quat();
@ -19,7 +20,20 @@ class LookAtNode extends LogicNode {
if (vfrom == null || vto == null) return null;
v1.set(0, 0, 1);
switch (property0) {
case "X":
v1.set(1, 0, 0);
case "-X":
v1.set(-1, 0, 0);
case "Y":
v1.set(0, 1, 0);
case "-Y":
v1.set(0, -1, 0);
case "Z":
v1.set(0, 0, 1);
case "-Z":
v1.set(0, 0, -1);
}
v2.setFrom(vto).sub(vfrom).normalize();
q.fromTo(v1, v2);