Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007532opensim[MISC] Compiling / Buildingpublic2015-04-19 08:042016-10-15 19:32
ReporterHelios.Q 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformWindowsOSWindows 7OS Version
Product Version 
Target VersionFixed in Version 
Summary0007532: Camera upon unsit in Lifts
DescriptionCreating Turbolifts (elevators) from Star Trek. Have the camera changed to view from inside behind the avatar facing the doors. Upon unsitting, the avatar stands up and faces (along with the camera reverting back) to face the way it was prior to sitting. I tested the script in several OpenSim's and then in Second Life. In Second Life it behaves as is expected to.
Steps To ReproduceLIFT SCRIPT

string DEFAULT_POSE = "stand"; // Default pose used if there is no animation in the seat prim

vector SIT_POS = <0.0, 0.0, 1.0>; // Where do you want them to sit on the ball?
rotation SIT_ROT = ZERO_ROTATION; // Which direction should they face?

// Set CAMERA_OFFSET and CAMERA_LOOKAT to ZERO_VECTOR to remove camera constraints.
vector CAMERA_OFFSET = <-1.0, 0.0, 2.0>; // Place camera behind 1 meter behind the user's head
vector CAMERA_LOOKAT = <1.0, 0.0, 2.0>; // aimed at a point 1 meter in front of the user

// =========================================================================
// Don't change anything below this line unless you're comfortable scripting
// =========================================================================

string anim;

integer debug = FALSE;
integer turboChannel;
list platform = [];
list platforms;
list MAIN_MENU;

debugSay(string msg) {
    if (debug) llOwnerSay(msg);
}

moveLift(string p)
{
    integer i = llListFindList(platforms, llParseString2List(p, [], []) );
    if (i >= 0) {
        llWhisper(turboChannel, "DEPARTED");
        llMessageLinked(LINK_SET,0,"CLOSEDOOR", NULL_KEY);
        llTriggerSound("a09a481a-cc97-47e1-83b5-c894912d332a",.9);
        llSleep(0.5);
        llTriggerSound("9686a6bb-3ab4-7c7e-3de6-22a1aa082f87",.9);
        vector target = (vector) llList2String(platforms, i+1);
        rotation rot = (rotation) llList2String(platforms, i+2);
        llSetRot(rot);
        while (llVecDist(llGetPos(), target) > 0.0001) {
            llSetPos(target);
            //llSleep(0.01);
        }
        llMessageLinked(LINK_SET,0,"OPENDOOR", NULL_KEY);
        llPlaySound("a09a481a-cc97-47e1-83b5-c894912d332a",.9);
        llStopSound();
        llWhisper(turboChannel, "ARRIVED: " + p);
        llUnSit(llAvatarOnSitTarget());
    }
}

addPlatform() {
    integer i = llListFindList( platforms, llParseString2List(llList2String(platform, 1), [], []) );
    if (i < 0) platforms += [llList2String(platform, 1), (vector) llList2String(platform, 2), (rotation) llList2String(platform, 3)];
    else platforms = llListReplaceList(platforms, [llList2String(platform, 1), (vector) llList2String(platform, 2), (rotation) llList2String(platform, 3)], i, i+2);
}

makeMenu() {
    MAIN_MENU = ["Report"];
    integer i;
    for (i=0; i<(llGetListLength(platforms) / 3); i++) {
        MAIN_MENU += [llList2String(platforms, i*3)];
    }
}

showMenu(key avatar) {
    makeMenu();
    llDialog(avatar, "Select Deck", MAIN_MENU, turboChannel);
}

init()
{
    turboChannel = (integer)("0x" + llGetSubString(llMD5String(llGetObjectDesc(),0), 0, 7));
    llListen(turboChannel, "", NULL_KEY, "");
    llRegionSay(turboChannel,"ALLTURBOLIFTSREPORT");
    //llStopAnimation("sit");
    //makeMenu();
}



default
{
    state_entry()
    {
        llSitTarget( SIT_POS, SIT_ROT );
        llSetCameraEyeOffset( CAMERA_OFFSET );
        llSetCameraAtOffset( CAMERA_LOOKAT );
        // Check for an animation in inventory. If found, use it instead of the default.
        string pose = llGetInventoryName(INVENTORY_ANIMATION, 0);
        if (pose != "") {
            anim = pose;
        } else {
            anim = DEFAULT_POSE;
        }
        llPreloadSound("a09a481a-cc97-47e1-83b5-c894912d332a"); // Close Door
        llPreloadSound("9686a6bb-3ab4-7c7e-3de6-22a1aa082f87"); // Turbolift
        llPreloadSound("a09a481a-cc97-47e1-83b5-c894912d332a"); // Open door
        init();
    }

    touch_start(integer total_number)
    {
       showMenu(llDetectedKey(0));
    }

    changed(integer change)
    {
        integer ok = (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION);
        
        if (change & CHANGED_LINK) {
            key avatar = llAvatarOnSitTarget();
            //if (avatar != NULL_KEY) showMenu(avatar);
            if (llAvatarOnSitTarget() != NULL_KEY) {
                // We have a new user. Tell the elevator who the pilot is and request animation permissions.
                llMessageLinked(LINK_SET, 0, "CCpilot", llAvatarOnSitTarget());
                llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
       showMenu(llAvatarOnSitTarget());
            } else {
                // Our operator has left. Clear the pilot and make the help text visible if enabled
                llMessageLinked(LINK_SET, 0, "CCpilot", NULL_KEY);
            }
        }
        else if (change & CHANGED_INVENTORY) {
            // Check for an animation in inventory. If found, use it instead of the default.
            string pose = llGetInventoryName(INVENTORY_ANIMATION, 0);
            if (pose != "") {
                anim = pose;
            } else {
                anim = DEFAULT_POSE;
            }
        }
    }

    link_message(integer sender_num,integer num, string str, key id)
    {
                       if (str == "SHOWMENU") showMenu(id);
        if (str == "stop") {
            // We've come to a stop. Unsit our passengers.
            llSleep(0.2);
            llUnSit(llAvatarOnSitTarget());
        }
    }

    run_time_permissions(integer perm)
    {
        // If we've received animation permission, start the new animation and hide the hovertext (if any)
        if (perm & PERMISSION_TRIGGER_ANIMATION) {
            llStopAnimation("sit");
            llStartAnimation(anim);
        }
    }

    listen(integer channel, string name, key id, string msg)
    {

         if (channel == turboChannel) {
            if (llSubStringIndex(msg, "|") >= 0) {
                platform = llParseString2List(msg, ["|"], []);
                addPlatform();
                if (llList2String(platform, 0) == "call") moveLift(llList2String(platform, 1));
            }
            else if (msg == "Report") {
                MAIN_MENU = [];
                llRegionSay(turboChannel, "ALLTURBOLIFTSREPORT");
            }
            else moveLift(msg);
        }
    }
}
Additional InformationCALL STOP SCRIPT (To actually call the lift)

integer turboChannel;

sayPosition(string what) {
    what += "|" + llGetObjectName() + "|" + (string) llGetPos() + "|" + (string) llGetRot();
    llRegionSay(turboChannel, what );
}

default
{
    state_entry()
    {
        turboChannel = (integer)("0x" + llGetSubString(llMD5String(llGetObjectDesc(),0), 0, 7));
        llListen(turboChannel, "", NULL_KEY, "");
        llOwnerSay( (string) turboChannel);
    }

    moving_end()
    {
        sayPosition("report");
    }

    touch_start(integer total_number)
    {
        sayPosition("call");
    }

    listen(integer channel, string name, key id, string msg) {
        if (msg == "ARRIVED: " + llGetObjectName()) llMessageLinked(LINK_SET, 0, "ARRIVED", NULL_KEY);
        else if (msg == "DEPARTED") llMessageLinked(LINK_SET, 0, "DEPARTED", NULL_KEY);
        else if (msg == "ALLTURBOLIFTSREPORT") sayPosition("report");
    }
}
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (Multiple Regions per Sim)
Physics EngineBulletSim
Script Engine
EnvironmentUnknown
Mono VersionOther
ViewerFirestorm, Singularity
Attached Files

- Relationships

-  Notes
(0028032)
Ares Q (reporter)
2015-04-20 02:07

I second this...
In OpenSim, the camera (and avatar when unsit) is reverted back to the previous state, in SecondLife the camera and the avatar aswell, is facing the set Camera Direction.
(0029493)
Helios.Q (reporter)
2015-09-23 11:07

This is still occurring. Is there any work around if there are no fixes yet?
(0031202)
Helios.Q (reporter)
2016-10-15 19:32

I have noticed that this does not seem to appear to happen when in mouselook.

- Issue History
Date Modified Username Field Change
2015-04-19 08:04 Helios.Q New Issue
2015-04-20 02:07 Ares Q Note Added: 0028032
2015-09-23 11:07 Helios.Q Note Added: 0029493
2016-10-15 19:32 Helios.Q Note Added: 0031202


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker