Fix for null parent

This commit is contained in:
Henrique 2021-06-27 18:26:13 -03:00
parent f940e8566e
commit 13c1e0508d
2 changed files with 2 additions and 4 deletions

View file

@ -17,7 +17,7 @@ class GetLocationNode extends LogicNode {
var loc = object.transform.world.getLoc();
if (relative) {
if (relative && object.parent != null) {
loc.sub(object.parent.transform.world.getLoc()); // Add parent location influence
// Convert vec to parent local space

View file

@ -6,8 +6,6 @@ import armory.trait.physics.RigidBody;
class SetLocationNode extends LogicNode {
var quat = new Quat();
public function new(tree: LogicTree) {
super(tree);
}
@ -19,7 +17,7 @@ class SetLocationNode extends LogicNode {
if (object == null || vec == null) return;
if (!relative) {
if (!relative && object.parent != null) {
vec.sub(object.parent.transform.world.getLoc()); // Remove parent location influence
// Convert vec to parent local space