move_to explanation?

Post Reply
KCoombes
Member
Posts: 412
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt
Location: SW Florida, USA

move_to explanation?

by KCoombes » Post

While going through the lua_api.txt, I spotted the ObjectRef method `move_to(pos, continuous=false)' and was confused by the 'continuous' part - once an object has moved to the 'pos', isn't that it? How could it be continuous after completing the action?

User avatar
Krock
Developer
Posts: 4577
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: move_to explanation?

by Krock » Post

`move_to` moves the objects to a position and tells the client to interpolate this movement. The interpolation calculates the position in between using differentials, so far movements first appear very fast and slow down the nearer they are to the destination point.
`continuous` basically indicates whether the movement is done at the destination point or not. If you use the function multiple times (say, 5 times per second) with only slightly changing movement directions, then you might get a nicer looking movement using `continuous`.
Code reference: https://github.com/minetest/minetest/bl ... pp#L95-L97
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

Re: move_to explanation?

by stu » Post

KCoombes wrote:While going through the lua_api.txt, I spotted the ObjectRef method `move_to(pos, continuous=false)' and was confused by the 'continuous' part - once an object has moved to the 'pos', isn't that it? How could it be continuous after completing the action?
This is something I have also found very confusing and it seems to be no less confusing even looking at the source.

https://github.com/minetest/minetest/bl ... #L618-L626

From what I can tell, setting `continuous` true results is the sao base position being updated but not actually sent. At a guess I'd say it was some ugly hack to achieve a specific effect at some point, in my experience it would appear to give a smoother transition from a->b but I have no idea of its intended purpose.

Edit: Thanks Krock for the explanation, however, it still does not make a great deal of sense to me. IMO it would be a lot more useful if we were able to specify time taken or even approximate speed.

Post Reply

Who is online

Users browsing this forum: hlqkj, ywwv and 5 guests