Jump to content

How does SL movement work


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

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

Recommended Posts

I'm looking for a basic to intermediate understanding of how movement in SL works, and what affects it.

My current understanding is that it is done by a physics engine, and that movement is the result of forces.  Is this correct?  I presume pressing a key on the keyboard generates forces, but I have no idea how the standardized maximum velocities of walking and running avatars arise from this process - what exactly happens when you press a key that makes your avatar move, and why is the standard voluntary walking speed a constant 3.2 m/s?  If there was a constant force on an avatar, it would accelerate indefinitely, which would be unphysical,  and is not what actually happens.

I know movement enhancers exist, they seem to use llSetForce and llApplyImpulse commands.  And llPushObject can move avatars.  Collisions with objects (physical and nonphysical) can also affect movement.  Is there anything else that affects movement?

On a related note,  assuming some of the above is  correct, where are the calculations performed?   What calculations are done by the client, and what calculations are done by the host?  And what mechanism synchronizes the  position of the avatar in the client and the position of the avatar in the host?  I'm pretty sure the two get out of synch, this results in a "rubberbanding" effect, I've seen in world, but I'm puzzled about the details.

  • Like 1
Link to comment
Share on other sites

There are no "forces" in SL, obviously, because this is a simulated environment.  Avatar movements can be initiated and controlled in the client software by pressing on keyboard keys, or they can be modified server side by interaction with other objects (collisions) or by simulated forces of gravity and friction. 

As you deduced, the client and server have to be as nearly in sync as possible, because the server software has to be able to send all other avatars within visual range precise information about the positions and velocities of each avatar (and all other objects).  Information is exchanged between clients and the servers in 45 frames per second. Being out of sync by more than about 100 msec results in visible positioning errors (lag), incorrect velocities (creating rubber-banding, for example), or disconnection. The positioning calculations are all done server-side, because that's where the uploaded information from all avatars in the region are collected. 

Objects being controlled by scripts and physical objects under the influence of gravity, friction, and any new forces introduced by the scripts themselves are also managed server-side. LSL scripts run in the servers, which then send any position/velocity/collision information to clients connected to the region. Animations, however, are managed client-side.  So, for example, movements of each avatar body's arms, legs, etc. are all calculated in your viewer. Those movements are not echoed back to the servers. Thus, several people watching the same set of avatars dancing in world may see them in slightly different poses at any instant.  

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

2 hours ago, Nano Siemens said:

Is this correct?  I presume pressing a key on the keyboard generates forces, but I have no idea how the standardized maximum velocities of walking and running avatars arise from this process - what exactly happens when you press a key that makes your avatar move, and why is the standard voluntary walking speed a constant 3.2 m/s? 

When you push a key that makes your avatar move, a message indicating a key press initiated move is sent to the server. When you press a key that makes your avatar turn, though, the avatar and camera turn in the viewer, and a message indicating the new facing direction is sent to the server. This is special for avatars; other moving objects are entirely server-controlled. The message is called an AgentUpdate and is sent over UDP.

The server gets the AgentUpdate, and at the beginning of the next frame, computes the new position of the avatar. There's an attempt to move the avatar in the desired direction at a fixed speed for the avatar mode (walk, run, or fly). Collision detection and collision response is performed. For collision detection purposes, the avatar is a cylinder-like shape (a bit broader at the midsection, which is not well known). Arm and leg positions and attachments are ignored for collision purposes.

Avatars are semi-physical objects - you can push them around, but can't knock them down. Unlike vehicles,  which can pitch, roll, and yaw, as well as move and turn at variable speeds. This is to make avatars controllable with arrow keys. If you want full motion control, you need full body tracking like VRchat has.

All viewers looking at the area where the avatar is get an update message, called an ImprovedTerseObjectUpdate, which gives the object's new position and orientation. This has both position and velocity information, and the viewer moves the avatar accordingly. ImprovedTerseObjectUpdate messsages are sent only when some movement happens, and for movement in a straight line, only once every 1 or 2 seconds. When there's a sudden change in direction or speed, the viewer, which is always a little behind, has to correct the prediction it made, which can result in rubber-banding and some other undesirable effects. This is seldom much of an issue at walking speed, but is a big issue for vehicles.

That's roughly it.

  • Like 5
Link to comment
Share on other sites

1 minute ago, Jaylinbridges said:

So how does a HUD attachment that increases the speed of an avatar work?  You can send a different walk or run speed to the server for an avatar?

A script in an avatar attachment can make all the usual Linden Scripting Language calls to move an object. Most of them work on avatars. You can override the built-in walk system that way. There are "wearable vehicles" which use this to give avatars vehicle-like behavior.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

12 hours ago, Jaylinbridges said:

So how does a HUD attachment that increases the speed of an avatar work?  You can send a different walk or run speed to the server for an avatar?

 

That one I know a little bit about.   It's done by an LSL script, typically with  LSL commands such as llSetForce() and llApplyImpulse().  Reading a bit about this, there are other commands as well, see for instance the forum post linked below.  I don't know any further details.

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 966 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...