Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007673opensim[REGION] OpenSim Corepublic2015-08-07 07:172019-02-06 11:50
ReporterJeffKelley 
Assigned Tomelanie 
PrioritynormalSeverityminorReproducibilitysometimes
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Versionmaster (dev code) 
Target VersionFixed in Version 
Summary0007673: Extra moving_end triggered by llSetKeyframedMotion
DescriptionOccasionally, llSetKeyframedMotion fires an extra moving_end event. The following script makes a prim run around a square. When the actual travel distance, computed by subtracting the present position from the start position, is less than predicted, an alert is issued. It shows that the travel distance is zero, and the elapsed time less than a millisecond.

Another point to note is that llSetKeyframedMotion never fires moving_start. (It should, according to LSL wiki.)
Steps To Reproducefloat extent = 50.0; // Meters
float speed = 200.0; // Meters/s
integer direction; // E,N,W,S

vector GetDisplacement() {
    if (direction == 0) return extent * < 1, 0, 0 >;
    if (direction == 1) return extent * < 0, 1, 0 >;
    if (direction == 2) return extent * <-1, 0, 0 >;
    if (direction == 3) return extent * < 0,-1, 0 >;
    return ZERO_VECTOR;
}


vector startPosition; // To detect extra moving_end
float startTime; // To detect extra moving_end


Move() {
    vector displac = GetDisplacement();
    float duration = llVecMag(displac) / speed;

    startPosition = llGetPos(); // To detect extra moving_end
    startTime = llGetTime(); // To detect extra moving_end

    llSetKeyframedMotion (
        [ displac, ZERO_ROTATION, duration ],
        [ KFM_DATA, KFM_TRANSLATION|KFM_ROTATION, KFM_MODE, KFM_FORWARD ]
    );

    if (++direction == 4) direction = 0;
}

integer OkEvent() {
    float elapsed = llGetTime() - startTime;
    float traveled = llVecDist (llGetPos(), startPosition);

    if (traveled < 1.0) {
        llOwnerSay ("EXTRA MOVING_END EVENT !!!");
        llOwnerSay ((string) [ "Elapsed was ", elapsed ]);
        llOwnerSay ((string) [ "Traveled was ", traveled ]);
        llOwnerSay ("Please report this");
        return FALSE;
    }

    return TRUE;
}


default {

    state_entry() {
        llSetRegionPos (< 128-extent/2, 128-extent/2, 22 >);
        Move();
    }
    
    moving_start() {
        llOwnerSay ("moving_start");
    }

    moving_end() {
        if (OkEvent()) Move();
    }
}


Example output:

[06:34] MANTISXXXX: EXTRA MOVING_END EVENT !!!
[06:34] MANTISXXXX: Elapsed was 0.000458
[06:34] MANTISXXXX: Traveled was 0.000000
[06:34] MANTISXXXX: Please report this
[06:36] MANTISXXXX: EXTRA MOVING_END EVENT !!!
[06:36] MANTISXXXX: Elapsed was 0.000512
[06:36] MANTISXXXX: Traveled was 0.000000
[06:36] MANTISXXXX: Please report this
Additional InformationMaster git 8de65a8 with Bullet physics, MONO 3.2.5.
TagsNo tags attached.
Git Revision or version number8de65a8fb360f9ab99a609311dfb56e15a9de76c
Run Mode Grid (Multiple Regions per Sim)
Physics EngineBulletSim
EnvironmentMono / Linux64
Mono Version3.2
Viewer
Attached Filespatch file icon 0001-Fix-moving_end-and-add-moving_start-to-llSe.patch [^] (2,263 bytes) 2015-08-13 01:24 [Show Content]

- Relationships

-  Notes
(0029124)
Garmin Kawaguichi (reporter)
2015-08-08 00:09

If you can compile the source, you could try the following changes in OpenSim\Region\Framework\Scenes\KeyframeMotion.cs:

1) TriggerMovingEndEvent
Ln 642 in public void OnTimer(double tickDuration)
After Stop();
Replace
                    Scene scene = m_group.Scene;

                    IScriptModule[] scriptModules = scene.RequestModuleInterfaces<IScriptModule>();
                    foreach (IScriptModule m in scriptModules)
                    {
                        if (m == null)
                            continue;
                        m.PostObjectEvent(m_group.RootPart.UUID, "moving_end", new object[0]);
                    }
By
                    m_group.Scene.EventManager.TriggerMovingEndEvent(m_group.RootPart.LocalId);
-----------------------------------------

2) Ln 637 in public void OnTimer(double tickDuration)
Before GetNextList();
Add
                if (!m_running) return;
-----------------------------------------
3) Add a moving_start event
Ln 457 in public void Start()
After
                StartTimer();
                m_running = true;
Add
                m_group.Scene.EventManager.TriggerMovingStartEvent(m_group.RootPart.LocalId);
-----------------------------------------

I hope this helps
GCI
(0029125)
JeffKelley (reporter)
2015-08-08 09:04

1/ moving_start fires
2/ I have seen no duplicate moving_end *yet*

I have installed a chat logger and will report again tomorrow.
(0029129)
JeffKelley (reporter)
2015-08-09 07:25

No duplicate event after 24 hours (roughly 80000 calls).
Your patch looks good. Thanks.
(0034617)
BillBlight (developer)
2019-02-06 11:50

Marked as Resolved but never closed, can be reopened if needed.

- Issue History
Date Modified Username Field Change
2015-08-07 07:17 JeffKelley New Issue
2015-08-08 00:09 Garmin Kawaguichi Note Added: 0029124
2015-08-08 09:04 JeffKelley Note Added: 0029125
2015-08-09 07:25 JeffKelley Note Added: 0029129
2015-08-13 01:24 JeffKelley File Added: 0001-Fix-moving_end-and-add-moving_start-to-llSe.patch
2015-08-13 01:27 JeffKelley Status new => patch included
2015-08-19 15:24 melanie Status patch included => resolved
2015-08-19 15:24 melanie Resolution open => fixed
2015-08-19 15:24 melanie Assigned To => melanie
2019-02-06 11:50 BillBlight Note Added: 0034617
2019-02-06 11:50 BillBlight Status resolved => closed


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker