Jump to content

Handle a Vector2


Recommended Posts

I have a problem handling the "player:getAngle()"-function,


print(player:getAngle() ) shows a string like:

Vector2 (X: 0,000000, Y: -1,000000) (L: 1,000000, D:3,141593)


Can anyone tell me how I get D (the direction of the Vector2) ?



To be honest, before build 32, I was able to get this string with player:getAngle():toString() and then just extracted the value of D out of the string.


But now with build 32 this is not working any more.

Seens like toString() doesn't exist in this function/method/... any more.


I am stuck at this point.


Some help would be nice... (Thanks)

Link to comment
Share on other sites

toString should work for anything going through java/kahlua, but as far as I know, it should be toString(player.getAngle())

Edit: Apparently toString is a native lua method, but its still used the same way.

Link to comment
Share on other sites

:D :D :D  Thanks a lot, EasyPickins :D :D :D




But how can I grab the direction D then?

player:getAngle():getD() ?


If someone knows, please tell me.

Otherwise i will have to test and find out on my own...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...