MantisBT - opensim
View Issue Details
0007129opensim[REGION] Specific OpenSim Modulepublic2014-04-23 18:252014-12-11 06:24
Gwyneth Llewelyn 
normalminorhave not tried
PCUbuntu14.04 LTS
master (dev code) 
OpenSim 0.8.0 Dev 722f030 (interface version 7)
Grid (Multiple Regions per Sim)
Mono / Linux64
0007129: osNpcSit on prim does not immediately sit the avatar
A year ago, this was reported by Rameshsharma Ramloll on the opensim-users mailing list: [^]

I just tested it under 0.8.0 Dev (latest git). When giving a osNpcMoveToTarget command towards a prim, followed by a osNpcSit command on that very same prim, the NPC will just stand beneath it. Once the NPC is not moving any longer, then osNpcSit works immediately.

Apparently sitting will only work if the NPC is not moving.
I'm using a slightly modified version of the NPC manipulator adapted by justincc 0.0.3 released 20121025 ( [^]) just to do some tests.
A possible workaround is to check if the avatar is not moving before emitting the osNpcSit command. I do that by attaching an object to the NPC (which tracks more information anyway) and looking to see if the current velocity is zero, and waiting if it's not. This is a bit tricky and results might differ between ODE and BulletSim (i.e. velocity might not be _exactly_ zero when the NPC _seems_ stationary).
NPC, osNpcSit, sit
Issue History
2014-04-23 18:25Gwyneth LlewelynNew Issue
2014-04-23 18:26Gwyneth LlewelynTag Attached: NPC
2014-04-23 18:26Gwyneth LlewelynTag Attached: sit
2014-04-23 18:26Gwyneth LlewelynTag Attached: osNpcSit
2014-12-11 06:24dzNote Added: 0027086

2014-12-11 06:24   
I have experienced a similar problem. In my case the NPC walks toward a bench to sit on it. The NPC would "sit" (triggering the proper animation), however its motion would not stop... so it would appear to drift off into space slowly.

The simple solution was to include a stopMoveTo command before having the NPC sit.
This seems to be extremely reliable and does not require any velocity detections or delay between the stop and sit commands.

        osNpcStopMoveToTarget( npc );
        osNpcSit(npc, theBench, OS_NPC_SIT_NOW);