Page 1 of 1

How do I get the velocity of a player?

PostPosted: Fri Jun 27, 2014 20:54
by Wuzzy
How do I get the velocity of a player?

I already tried
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
player:getvelocity()

, where “player” is a player object.
But it returns nil.

Re: How do I get the velocity of a player?

PostPosted: Fri Jun 27, 2014 21:18
by Calinou
Wuzzy wrote:How do I get the velocity of a player?


I'm sorry Dave, I'm afraid we can't do that: https://github.com/minetest/minetest/issues/1176

However, you can maybe try comparing player positions between two steps.

Re: How do I get the velocity of a player?

PostPosted: Fri Jun 27, 2014 21:46
by webdesigner97
Calinou wrote:
Wuzzy wrote:How do I get the velocity of a player?


I'm sorry Dave, I'm afraid we can't do that: https://github.com/minetest/minetest/issues/1176

However, you can maybe try comparing player positions between two steps.

v = Δs / Δt :)

Re: How do I get the velocity of a player?

PostPosted: Sat Jun 28, 2014 03:52
by Wuzzy
Too bad I also want to set the velocity of a player. :(

Re: How do I get the velocity of a player?

PostPosted: Sat Jun 28, 2014 07:40
by hoodedice
How about attaching an invisible LuaEntitySAO to the player, and then manipulating that SAO? Kinda hacky, but might work.