Hello,
I'm using JavaScript and while getting player position by this:
I'm getting error:Code:commandGetPos: function(session, cmd, arg) { var position = session.WorldPlayerEntity.transform.position; this.chat(position, false, session); }
(session.WorldPlayerEntity.transform is returning PlayerServer(Clone) (UnityEngine.Transform))
Any ideas?Code:(InvalidOperationException: No matching indexer found.)
Solved Getting player position (JS)
Discussion in 'Hurtworld Development' started by SilentHillft, Feb 3, 2016.
-
I don't really know JS, but this should work:
Code:commandGetPos: function(session, cmd, arg) { var position = session.WorldPlayerEntity.transform.position; this.chat(position.toString() , false, session); }
Code:commandGetPos: function(session, cmd, arg) { var position = session.WorldPlayerEntity.transform.position; this.chat("x: " + position.x.toString() + ", y: " + position.y.toString() + ", z: " + position.z.toString() , false, session); }
-
LaserHydra, great. That's it. Thanks a lot.
I was in hope that will print "object" instand of throwing error.