Use this lua command in an update loop:
- Code: Select all
direction = newType.vec3(entity.getDirection(entity.getIDFromTag("enemy"), obj));
forward = newType.vec3(entity.getForward(obj));
angle = vector3.angle(direction.x, direction.y, direction.z, forward.x, forward.y, forward.z );
sky.lprint("angle: "..angle);
Great for enemy visibility or player targeting etc..
Example image: