Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008634opensim[REGION] Script Functionspublic2019-12-08 07:562020-01-25 07:58
ReporterKayaker Magic 
Assigned To 
PrioritylowSeverityfeatureReproducibilityN/A
StatusnewResolutionopen 
PlatformLinux MonoOSOpenSim 0.9.1OS Version0.9.1
Product Version0.9.1.0 
Target VersionFixed in Version 
Summary0008634: Request a method to set the position of an avatar when standing
DescriptionWhen an avatar "stands up" while sitting on an object, several undesirable things can happen. Depending on the physics engine the avatar can get tossed up in the air, stuck inside or on top of nearby objects. It is common to mark furniture as phantom to prevent this, but problems still occur.

There used to be an undocumented feature where an avatar moved back to the sit target position when standing up. A script could set the sit target behind the chair, for example, and then move the avatar to the sitting position while animating her. Then when the avatar stood up she would find herself behind the chair. This no longer works, and hasn't worked since OpenSim 0.7 or so.

Experimentation seems to indicate that now when an avatar stands up they are moved one meter forward from where they are currently located. In the case of an avatar sitting on a stool in front of a bar, when they stand up they find themselves inside the bar, standing on top of it, or getting shoved around by the physics engine.

It would be nice to have a way to control what happens to an avatar when they stand up.
1) One solution would be to put back in the undocumented feature of moving the avatar to the sit target on standing.
2) Another would be to add an OSSL function that allows setting the location to move the avatar to on standing. (osStandTarget(key,vector)?)
3) Another would be to add an event (perhaps in changed?) that warns the script that the avatar is about to stand up. Then the script could move the avatar like a child prim to the desired stand up position. The current changed event is called AFTER the avatar is already unlinked from the object and it is too late to move them.
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (1 Region per Sim)
Physics EngineubODE
Script EngineXEngine
EnvironmentMono / Linux64
Mono Version6.x
Viewerany
Attached Files

- Relationships
duplicate of 0008503new When Avi gets up after sitting he makes an unnatural air jump 

-  Notes
(0035963)
Data Rossini (reporter)
2019-12-11 01:56

I also had problems with "stand up" Avis from prims since 0.9.
After standig up, the Avis stuck at in the ceiling above it (at usual room height).
Since a patch to 0.8 solution, it works better.
However, I only use the BulletSim physics engine.

ScenePresence.cs:
v0.9.x line: 3280: Vector3 adjustmentForSitPose = new Vector3(0.75f, 0, m_sitAvatarHeight + .3f) * standRotationZ;
v0.8: Vector3 adjustmentForSitPose = new Vector3(0.74f, 0f, 0f) * standRotation;


Also problematic are objects that lie in front of the seat, which I then either switch "phantom" or teleport the avi to a suitable position (in a confined environment) after standig up.

Example script snipplet after stand up:

   vector tppos = llGetPos();
   tppos.x = tppos.x + standup_offset.x;
   tppos.y = tppos.y + standup_offset.y;
   tppos.z = tppos.z + standup_offset.z;
   osTeleportAgent(user, tppos, <1,1,1>);

:-)
(0035967)
tampa (reporter)
2019-12-11 06:37

Just teleport them or make the object phantom for a bit after the avatar stands up.
(0035977)
Kayaker Magic (reporter)
2019-12-12 00:41

OH! Great idea! Use a function that has THREAT LEVEL SEVERE just to land an avatar a meter or two away. Well it sometimes works, but usually SPAMs everyone in the region with error messages. Too bad there is no way to find out first if you have permission to call osTeleportAgent. Oh wait! I wrote a patch to add that! (Mantis 8634) But Ubit refuses to consider adding this to Master because "BAH! You don't need to know that!"

Making the chair phantom for a bit after the avatar stands up is problematical. Most people make all their furniture phantom to try and fix this. Then if you are lucky you end up standing in the middle of your phantom furniture. And then if you make it non-phantom after "a bit" that just puts off the problem "for a bit".

Curiously, it looks like someone is adding a new function osLocalTeleportAgent that currently has threat level NONE! This may solve the problem.
(0035979)
tampa (reporter)
2019-12-12 02:19

I mean I was taught not to stand on furniture anyways because that's kind of rude and non-sensical so I don't understand why anyone would want those things to be solid in the first place. Nevermind that I have not actually seen or heard anyone complain about this, it seems to me an accepted fact that there are limitations to the engine and that there are ways to deal with them in a reasonable manner that seems to satisfy most people.

Things that are "nice to have" are just that, non-critical stuff that really does not need to be over-engineered like that with its own ossl function or whatnot. Besides, if you are talking chairs, just fire a changed and move the chair back, you know, like normal people do when they get up.
(0036027)
Ferd Frederix (reporter)
2020-01-04 13:56

I use llPushObject(llAvatarOnSitTarget,<0,0,100>, <0,0,100>, TRUE) and adjust the X and Y accordingly. Works in getting out of boats onto a dock, for one example I use. Can get fancier by adding in the rotation of the root prim.

Be nice if the Avi could be rotated, though. TP would be a good way to handle it - I wish I had thunk of it.
(0036028)
djphil (reporter)
2020-01-04 14:56

I also use push and teleport and I am not fully satisfied because the push lacks precision and the teleport reset the camera position when we get up.
(0036029)
Data Rossini (reporter)
2020-01-04 19:39

This problem has been noticed since the change from version 0.8 to 0.9.
I have recently been using a patch for version 0.9.1.1 Snail Dev from 2019-10-28, which I am using to alleviate the problem.
Here I can set in OpenSim.ini whether I prefer the old - or the new method of "standig up" the avi from a seat.

Example solution for new section in OpenSim.ini:
...
[AviStandUp]
;; Activate section and set Method to "old" if avis stand up moderate with old method.
;; If you deactivate section or set Method to "new" then avis standup with actual method
Method = "old"
...

Patch:
==================================
--- ScenePresence.cs.ori 2019-12-11 16:26:19.261352408 +0100
+++ ScenePresence.cs 2019-12-11 16:26:19.261352408 +0100
@@ -3277,7 +3277,15 @@
                     standRotationZ.Z = 0f;
                 }
 
- Vector3 adjustmentForSitPose = new Vector3(0.75f, 0, m_sitAvatarHeight + .3f) * standRotationZ;
+ Vector3 adjustmentForSitPose = new Vector3(0.75f, 0, m_sitAvatarHeight + .3f) * standRotationZ;
+
+ IConfig sconfig = m_scene.Config.Configs["AviStandUp"];
+ if (sconfig != null)
+ {
+ string mtd = sconfig.GetString("Method", "new");
+ if (mtd == "old")
+ adjustmentForSitPose = new Vector3(0.74f, 0f, 0f) * standRotationZ;
+ }
 
                 Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose;
                 m_pos = standPos;
==================================

But be careful! If you patch yourself, you have to know what you are doing and be aware that you may be able to destroy your OpenSim.

I also hope that the developers will offer a solution.

- Sorry for my bad english speaking
(0036049)
UbitUmarov (administrator)
2020-01-14 02:56

0.8 just used a offset identical to SL
but unlike current havok, our physics engines like so send you to the moon, if the avatar gets physical inside terrain or a prim.
since because of cameras, ceilings are usually very high, it is safer to set the position higher.
with current code, any value we use will have bad cases
adding a standing target could help, but scripter has no idea where the object will actually be placed.
on top of that we do have unscripted sits
(0036128)
UbitUmarov (administrator)
2020-01-20 08:23

did reduce the jump a bit. Let us know if avatar gets stuck or sent to moon using bullet
(0036135)
UbitUmarov (administrator)
2020-01-22 10:29
edited on: 2020-01-22 10:58

just did add
        osSetStandTarget(vector v);
        vector osGetStandTarget();

the vector is on prim local frame, and tells where to approximatly place the avatar feet.
<0, 0, 0 > disables it, and previus stand offset and logic is used.


also did add
        osSetSitActiveRange(float v);
        float osGetSitActiveRange();

if v < 0 requests to sit are silent ignored
if v == 0 region default is used
else requests from a avatar this is more than v meters away are ignored.

unscripted sits not done by physics still have the extra limit of 10m

note that on physics sits the stand position will be the same :(

this values are not saved, for now. They will be.
Please let us know any issues or what you think

(0036136)
djphil (reporter)
2020-01-22 10:29

Nice new feature, thank's a lot :)
(0036137)
Data Rossini (reporter)
2020-01-23 02:18
edited on: 2020-01-24 01:28

Thank you very much :-)

for new OSSL functions. Be sure to leave it inside as it is very useful.
The new functions work well and support sitting in an optimal way. Now we can define a relative position where the Avi is standing after stand up from seat.
I have test it with last version "opensim-0.9.2.0Dev-32-g59f4159" and BulletSim
with following script.

Addition!
However, the set values of the functions did not survive the region restart.
Therefore the script must react to the event "CHANGED_REGION_START".
Look at the "changed()" function.


// Test for new OSSL functions:
//
// osSetSitActiveRange(float range(),
// osSetStandTarget(vector feetAproxPosition),
// osGetSitActiveRange()
// osGetStandTarget()
//
// Create atest seat with a prim cube 0.5m x 0.5m x0.5m and approximately 0.6m above ground
// It works with sitanimation too.
//

// position and rotation to sit
// setup sit position
float sit_posX = 0.3;
float sit_posY = 0.0;
float sit_posZ = 0.65;
       
// Setup sitrotation in degree
float sit_rotX = 0.0;
float sit_rotY = 0.0;
float sit_rotZ = 0.1;

// Sit prim hover text
string HOVERTEXT="sit";

// Pie Menu Sit Text
string SIT_TEXT="Be Seated";

string animation;
key sitter;
vector position;
rotation rotate;

default
{
    state_entry()
    {
        llSetClickAction( CLICK_ACTION_SIT );
        llSetSitText(SIT_TEXT);
        llSetText(HOVERTEXT,<0,1,0>,1.0);

//// Test for new OSSL functions osSetSitActiveRange(float range(), osSetStandTarget(vector feetAproxPosition)
        // You can only sit on the seat within this area
        osSetSitActiveRange(5); // You can only sit on the seat within this area
        //osSetSitActiveRange(-1); // Sitting is denied
        //osSetSitActiveRange(0); // Region default. Sitting possible from greater distances
        
        // After getting up from the seat, position the Avi over approximately position of avatar feeds.
        osSetStandTarget(<1.135,-1.8,-0.5>);
        //osSetStandTarget(<1.135,1.8,3.0>);
        //osSetStandTarget(<0, 0, 0 >); // Region default. Standard behavior when standing up.
////
        position = < sit_posX, sit_posY, sit_posZ >;
        rotate = llEuler2Rot(< sit_rotX * DEG_TO_RAD, sit_rotY * DEG_TO_RAD, sit_rotZ * DEG_TO_RAD>);
        llSitTarget(position, rotate);
    }
    
    changed(integer change)
    {
        if (CHANGED_LINK & change)
        {
            sitter=llAvatarOnSitTarget();
            if (sitter != NULL_KEY)
            {
                llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
            }
            else
            {
                integer perm=llGetPermissions();
                if ((perm & PERMISSION_TRIGGER_ANIMATION) && llStringLength(animation)>0)
                llStopAnimation(animation);
                llWhisper(0,"Thank you for taking a seat here.");
                llSetText(HOVERTEXT,<0,1,0>,1.0);
                animation="";
            }
        }
        
        // After restart of region the functions osSetSitActiveRange and osSetStandTarget must be queried again
        if (CHANGED_REGION_START & change)
        {
            llResetScript();
        }
    }
    
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {
                llStopAnimation("sit");
                animation=llGetInventoryName(INVENTORY_ANIMATION,0);
                llStartAnimation(animation);
                llSetText("",<0,0,0>,0);
        }
    }

//// Test for new OSSL functions osGetSitActiveRange(), osGetStandTarget()
    touch_start(integer num_detected)
    {
        llOwnerSay("osGetSitActiveRange: " + (string)osGetSitActiveRange());
        llOwnerSay("osGetStandTarget: "+ (string)osGetStandTarget());
    }
////
}

(0036139)
UbitUmarov (administrator)
2020-01-25 05:55

added http://opensimulator.org/wiki/OsSetLinkSitActiveRange [^]
(0036140)
UbitUmarov (administrator)
2020-01-25 06:32

http://opensimulator.org/wiki/OsGetLinkSitActiveRange [^]
(0036141)
UbitUmarov (administrator)
2020-01-25 07:58

well just see http://opensimulator.org/wiki/0.9.2.0_Release#Changes_and_Fixes [^]

- Issue History
Date Modified Username Field Change
2019-12-08 07:56 Kayaker Magic New Issue
2019-12-11 01:56 Data Rossini Note Added: 0035963
2019-12-11 06:37 tampa Note Added: 0035967
2019-12-12 00:41 Kayaker Magic Note Added: 0035977
2019-12-12 02:19 tampa Note Added: 0035979
2019-12-12 02:59 Kayaker Magic Relationship added duplicate of 0008503
2020-01-04 13:56 Ferd Frederix Note Added: 0036027
2020-01-04 14:56 djphil Note Added: 0036028
2020-01-04 19:39 Data Rossini Note Added: 0036029
2020-01-14 02:56 UbitUmarov Note Added: 0036049
2020-01-20 08:23 UbitUmarov Note Added: 0036128
2020-01-22 10:29 UbitUmarov Note Added: 0036135
2020-01-22 10:29 djphil Note Added: 0036136
2020-01-22 10:39 UbitUmarov Note Edited: 0036135 View Revisions
2020-01-22 10:40 UbitUmarov Note Edited: 0036135 View Revisions
2020-01-22 10:40 UbitUmarov Note Edited: 0036135 View Revisions
2020-01-22 10:44 UbitUmarov Note Edited: 0036135 View Revisions
2020-01-22 10:58 UbitUmarov Note Edited: 0036135 View Revisions
2020-01-23 02:18 Data Rossini Note Added: 0036137
2020-01-23 02:18 Data Rossini Note Edited: 0036137 View Revisions
2020-01-23 02:22 Data Rossini Note Edited: 0036137 View Revisions
2020-01-23 02:22 Data Rossini Note Edited: 0036137 View Revisions
2020-01-23 02:25 Data Rossini Note Edited: 0036137 View Revisions
2020-01-24 00:10 Data Rossini Note Edited: 0036137 View Revisions
2020-01-24 00:21 Data Rossini Note Edited: 0036137 View Revisions
2020-01-24 00:22 Data Rossini Note Edited: 0036137 View Revisions
2020-01-24 01:28 Data Rossini Note Edited: 0036137 View Revisions
2020-01-25 05:55 UbitUmarov Note Added: 0036139
2020-01-25 06:32 UbitUmarov Note Added: 0036140
2020-01-25 07:58 UbitUmarov Note Added: 0036141


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker