[sldev] Re: movement within the client

alexander treptow alexander.treptow at zweitgeist.com
Fri Jan 11 00:58:53 PST 2008


LLVOAvatar *a = gAgent.getAvatarObject();
LLVector3 v = a->getPosition();
v[0] += 0.1f; //move in X
if(a)
  a->setPosition(v);

You can use this in the mainloop right before calling the display 
function. And you can save an offset vector to reset your avatar to a 
position you want. As far as i know walls or whatever doesnt matter and 
you can set your avatar to that position you want to. but i think 
serverside your avatar is still on its old position. that means if you 
set your avatar from one corner of the region to another .. the objects 
loaded from the grid refers to your old position.
hope this would be a little help ;)

greets,
Alex

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?



More information about the SLDev mailing list