[sldev] Re: movement within the client
Tateru Nino
tateru.nino at gmail.com
Thu Jan 10 10:53:57 PST 2008
Stan Vernier wrote:
> Tateru Nino wrote:
>>
>>
>> Stan Vernier wrote:
>>> Stan Vernier wrote:
>>>> I'm looking into being able to control the avatar within the client
>>>> and I'm trying to simulate the teleport script to move the avatar
>>>> from point a to point b within the same region. I can get the
>>>> avatar to move from a to b, but the moment I try to move the
>>>> avatar, it pops back to point a. I tried sendPositionUpdate(), but
>>>> it didn't work. Anyone got any suggestions?
>>>>
>>> So I've run into another dilemma with handling movement. I've
>>> figured out the functions to get movement - moveAt, moveUp, Yaw,
>>> Left, Pitch. What I'm stuck on now is how do I create a consistent
>>> movement like "move 10m forwards"?
>>
>> Calculate the destination position, and send motion commands, while
>> comparing reported avatar position with calculated destination, until
>> you get to where you're going? (Essentially approximating your way to
>> the target)
>> Of course, you're going to want to implement a pathfinding algorithm
>> the instant something solid winds up in the way.
>>
> I kinda tried that with a while loop with gAgent.moveAt(1) in it, but
> it just froze the client. I took a look at some of the other code for
> movement and it seems to only call a move command once and then
> somewhere down the line the rest of the movement gets dealt with. For
> the movement floater, it looks like it uses
> mMoveDownButton->setHeldDownCallback(moveUp). I guess my question is
> how to do this without holding a button?
>
You've got to do it asynchronously. If you aren't waiting for server
responses it'll definitely freeze. You've got to release the client to
perform other tasks and handle communications and other messages.
--
Tateru Nino
http://dwellonit.blogspot.com/
More information about the SLDev
mailing list