Sandy 2020-03-14 20:58:56 +09:00 committed by GitHub
parent 71796f4fab
commit d1a0fc69c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 23 deletions

View file

@ -22,12 +22,9 @@ class TranslateObjectNode extends LogicNode {
object.transform.buildMatrix(); object.transform.buildMatrix();
} }
else { else {
var look = object.transform.world.look().mult(vec.y); object.transform.move(object.transform.local.look(),vec.y);
var right = object.transform.world.right().mult(vec.x); object.transform.move(object.transform.local.up(),vec.z);
var up = object.transform.world.up().mult(vec.z); object.transform.move(object.transform.local.right(),vec.x);
object.transform.loc.add(look);
object.transform.loc.add(right);
object.transform.loc.add(up);
object.transform.buildMatrix(); object.transform.buildMatrix();
} }

View file

@ -1,14 +1,10 @@
package armory.logicnode; package armory.logicnode;
import iron.object.Object; import iron.object.Object;
import iron.math.Vec4;
import armory.trait.physics.RigidBody; import armory.trait.physics.RigidBody;
class TranslateOnLocalAxisNode extends LogicNode { class TranslateOnLocalAxisNode extends LogicNode {
var loc = new Vec4();
var vec = new Vec4();
public function new(tree: LogicTree) { public function new(tree: LogicTree) {
super(tree); super(tree);
} }
@ -21,21 +17,12 @@ class TranslateOnLocalAxisNode extends LogicNode {
if (object == null) return; if (object == null) return;
if (l == 1) loc.setFrom(object.transform.world.look()); if (ini) sp *= -1;
else if (l == 2) loc.setFrom(object.transform.world.up());
else if (l == 3) loc.setFrom(object.transform.world.right());
if (ini) { if (l == 1) object.transform.move(object.transform.local.look(),sp);
loc.x = -loc.x; else if (l == 2) object.transform.move(object.transform.local.up(),sp);
loc.y = -loc.y; else if (l == 3) object.transform.move(object.transform.local.right(),sp);
loc.z = -loc.z;
}
vec.x = loc.x * sp;
vec.y = loc.y * sp;
vec.z = loc.z * sp;
object.transform.loc.add(vec);
object.transform.buildMatrix(); object.transform.buildMatrix();
#if arm_physics #if arm_physics