Jump to content

Problem: Moving an avatar forward and keeping them there


Tommy Rampal
 Share

You are about to reply to a thread that has been inactive for 4652 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hey guys,

So I've been working on moving my avatar through LSL using llMoveToTarget, and have had some weird results.

vector vec = (llGetPos()-<.5,0,0>*-llGetRot());
llMoveToTarget(vec,0.5)

The code above moves the avatar fine, but in mostly a lot of cases it puts the avatar in a constant jitter (consistent small 'jumps' along the Z axis unless they move or rotate to correct it.

This is a problem for me because I also take controls to stop the avatar from moving and turning.

Is there an easy fix around this? I also experimented with taking someone else's position (e.g. llGetObjectDetails and moving .5 meters in front of their position) and it seems to be fine. So maybe the problem lies in how llMoveToTarget deals with the llGetPos() vector? This is also an attachment.

 

Thanks again

Link to comment
Share on other sites

well your formula is a but wonky there.... should be (pos + LoocalOffset * rot) if you are moving forward....

you might try a softer tau value, and if ground scrubbing (the cause of the jitter) is still an issue, try adding a very slight raising of the offset in the z height.

Link to comment
Share on other sites

Any avatar has a boundingBox which is used by the physical machine to determine when the avatar bumps into something or is being bumped by something.

In your case I suggested that the avatar is bumping the ground or the surface it is moving over:smileyhappy:

You say it helps to add a vertical offset and that suggests I am right.
You can make the offset a function of the avatar height in order to make it work for all avatar sizes.

  • Like 1
Link to comment
Share on other sites

Oh right! Well that's me learning eh? So I understand the concepts, but I'm struggling to make use of the avatar height/bounding box coordinates into some algorithm. Does llGetBoundingBox return local or region vectors? If it's region my problem is pretty much solved I guess.

Does that mean llGetPos is broken? I would've thought it'd return the same as the llGetBoundingBox differences?

Link to comment
Share on other sites

The bounding box moves with the avatar, the avatar is 'inside' it.
The size of the boundingbox is the size of the avatar you get using llGetAgentSize()
The position of the bounding box is where the center of the box is just like any box in SL and it is also the position of the avatar.

llGetPos() is not broken
When used in the root of an object attached to an avatar, it will always return the position of the avatar's center in region coordinates.

I don't see what you mean with boundingbox differences, the box has three dimensions: X, Y and Z

I hope this is helpful:smileyhappy:


  • Like 1
Link to comment
Share on other sites

Thanks!

I'll experiment some more later when I get on the viewer. So far its pretty much:

llMoveToTarget(llGetPos() + offset * llGetRot(),.75);

What would you say will be a safe algorithm to increment the Z axis depending on the height of the avatar? So far its set to a static 0,0,.1 where the jitter affects taller avatars.

By the differences, I meant the min and max vectors you get from llGetBindingBox

I applogise, I am slower than usual today; I am battling off 3 hours sleep and a migraine. ;_;

Link to comment
Share on other sites

don't use ll get bounding box, instead use llGetAgentSize.... you can then take the .z portions and divide it, adding the result to your offset to give you am avatar height dependent boost.

although I find it odd that different height avatars are scrubbing against the ground/floor at different rates.... avatars all weigh the same regardless of size, so pushing it up a hair should have the same effect regardless of height. (not that I disbelieve you, it's just odd and someone with time to kill may want to look into it)

  • Like 1
Link to comment
Share on other sites

Aha brilliant!

vector size = llGetAgentSize(llGetOwner());
vector target = (llGetPos() + <0,0,size.z/16> * llGetRot());

The code above seemed to work fine, and fixed my problem. Didn't really get to experiment what you described with the weight/mass; if anyone has an improvement, it'd be much appreciated!

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4652 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...