Swimming HUD

Creating animations
Post Reply
User avatar
Kaylee West
Posts: 7
Joined: Fri Oct 03, 2014 6:39 am
Has thanked: 0
Been thanked: 8 times

Swimming HUD

Post by Kaylee West »

Hi All!

I was wondering if anyone knows of any good swimming scripts or swimming HUDs for OpenSim/Kitely? A HUD would be best because it can be used anywhere, even where you don't have permissions to rez objects.

Any leads would be hugely appreciated.

Ty!

Kaylee :D
These users thanked the author Kaylee West for the post (total 2):
Ilan TochnerTonia Kara
Graham Mills
Posts: 1058
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 678 times
Been thanked: 809 times

Re: Swimming HUD

Post by Graham Mills »

I appreciate it's not quite what you're after but there is this on the Market:

https://www.kitely.com/market/product/3 ... ar=5091217
These users thanked the author Graham Mills for the post:
Tonia Kara
Graham Mills
Posts: 1058
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 678 times
Been thanked: 809 times

Re: Swimming HUD

Post by Graham Mills »

This may again be unsuitable for any number of reasons (no HUD, it's a physics-based vehicle script and needs a fair bit of work) but it seems to do the basics albeit with a bit of drift (source URL provided, lightly modded by me). It assumes there's a forward swimming animation called AO-Swim1-Male in a single cube prim. Just rez on water, rightclick, select Swim and use the arrow keys. Click Stand to finish.

Code: Select all

// :CATEGORY:vehicle
// :NAME:Vehicle
// :AUTHOR:ben
// :KEYWORDS:
// :CREATED:2014-09-08 19:11:57
// :EDITED:2014-09-08
// :ID:1044
// :NUM:1654
// :REV:1
// :WORLD:Second Life
// :DESCRIPTION:
// 
// :CODE:
// by Ben
// Some help from Casval and Dave
// Modified by Sarg Bjornson to work with the Mayan Jungle Slide

//https://www.outworldz.com/cgi/freescripts.plx?ID=1041

rotation rot;
key owner;




reset()
{
    vector pos = llGetPos();
    pos.z = pos.z + 2.0;
    llMoveToTarget(pos, 0.3);
    llRotLookAt(rot, 0.1, 1.0);
    llSleep(1.0);
    llStopLookAt();
    llStopMoveToTarget();
}
     

default
{    
    state_entry()
    {
        
        llSetSoundQueueing(FALSE);
        llPassCollisions(TRUE);

        llSetSitText("Swim");
        
        llSitTarget(<0.4, 0.0, -.5>, <0.00000, 0.0, 0.00000, -0.09>); 
        llSetCameraEyeOffset(<-4.0, 0.0, 3.00>);
        llSetCameraAtOffset(<0.0, 0.0, 2.0>);
        
        llSetVehicleType(VEHICLE_TYPE_CAR);
        llRemoveVehicleFlags(-1);
        
        llSetVehicleFlags(VEHICLE_FLAG_HOVER_WATER_ONLY | VEHICLE_FLAG_HOVER_UP_ONLY | VEHICLE_FLAG_NO_DEFLECTION_UP);
        
        llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.2);
        llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.15);
        llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 1.0);
        llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 1000.0);
        
        llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 1.0);
        llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 0.0);//0.1
        llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.1);
        llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.1);
        
        llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <10, 10, 10.0>);
        llSetVehicleVectorParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, <10.0, 10.0, 10>);
        
        llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.2);
        llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 0.5);        
        
        llSetVehicleFloatParam(VEHICLE_BUOYANCY, 0);
        llSetVehicleFloatParam(VEHICLE_HOVER_HEIGHT, 0.01);
        llSetVehicleFloatParam(VEHICLE_HOVER_EFFICIENCY, 0.5);
        
        llSetVehicleFloatParam(VEHICLE_HOVER_TIMESCALE, 0.1);      
        llSetVehicleFloatParam(VEHICLE_BANKING_EFFICIENCY, 0.1);
        llSetVehicleFloatParam(VEHICLE_BANKING_TIMESCALE, 0.01);
        llSetVehicleFloatParam(VEHICLE_BANKING_MIX, 1.0);
        
        llCollisionSound("", 0.0);
    }
    
    changed(integer change)
    {
        
        if (change & CHANGED_LINK)
        {
            key agent = NULL_KEY;
            agent = llAvatarOnSitTarget();
            
            if (agent != NULL_KEY)
            {
                    llSetStatus(STATUS_PHYSICS, TRUE);
                    llSetStatus(STATUS_PHANTOM, FALSE);
                    llSetAlpha(0.0, ALL_SIDES);
                    llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
                    llMessageLinked(LINK_SET, 0, "on", "");
                    llSetTimerEvent(1.0);
                    //llTargetOmega(<0,0,0.2>,PI/4,1.0);
                    llSetText("",<1,0,0>,0);
                    
        }
            else
            {
                
                llSetStatus(STATUS_PHYSICS, FALSE);
                llSetAlpha(1.0, ALL_SIDES);
                //llTargetOmega(<0,0,0>,PI/4,1.0);
                llReleaseControls();
                llMessageLinked(LINK_SET, 0, "off", "");
                llSetTimerEvent(0.0);
                llStopSound();
               
            } 
        }
        
    }
    
    run_time_permissions(integer perm)
    {
        if (perm)
        {
            llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_RIGHT | CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT | CONTROL_UP | CONTROL_DOWN, TRUE, FALSE);
        }
    }
    
    control(key id, integer level, integer edge)
    {
        vector angular_motor;
        key user = llAvatarOnSitTarget();
        
        if(level & CONTROL_FWD)
        {    
            
            osAvatarStopAnimation(user, "sit"); // Stop the default sit animation (IMPORTANT!)
            osAvatarPlayAnimation(user, "AO-Swim1-Male");
            llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <2, 0, 0>);//16
                
        }
        if(level & CONTROL_BACK)
        {
            osAvatarStopAnimation(user, "AO-Swim1-Male"); // Stop the default sit animation (IMPORTANT!)
            osAvatarPlayAnimation(user, "stand");
            llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <-2,0,0>);//-16
            
        }
       
        if(level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))
        {
            
            angular_motor.z = -PI * 0.25;//0.5
            
            
        }
        if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT))
        {
           
            angular_motor.z = PI * 0.25;//0.5
          
            
        }
        if(level & (CONTROL_DOWN))
        {
        //llPlaySound("horn",1.0);     
        }
        else if(level == FALSE)
        {
           
        }
        llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular_motor);
    }
    
    timer()
    {
        vector pos = llGetPos();
        if(( pos.z - llGround(ZERO_VECTOR) ) < 0.8)
        {
            rot = llGetRot();
        }
    }
    
    
    
}
Graham Mills
Posts: 1058
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 678 times
Been thanked: 809 times

Re: Swimming HUD

Post by Graham Mills »

Again, not HUD-based but a simple swim attachment available as a freebie at the Quintonia Farming exhibit at OpenSim Fest (ends soon). Only works underwater for me and you need to relog on return to Kitely to make it work (well, I did).

opensimfest.org:80:Fest Landing
User avatar
Kaylee West
Posts: 7
Joined: Fri Oct 03, 2014 6:39 am
Has thanked: 0
Been thanked: 8 times

Re: Swimming HUD

Post by Kaylee West »

Hi Graham,

Sorry for the long delay in thanking you for your suggestions.

Unfortunately by the time I saw your post the OpenSimFest regions were no longer online. Unfortunately I was also unable to find a hypergrid address for Quintionia.

I actually happened to already have the swim object from the marketplace that you mentioned. It's pretty good, but again the limitation is that you have to have rezzing rights to be able to use it.

I guess the main problem is the OpenSim engines are not currently configured to allow wearable swimming scripts to work. I can't even get llSetHoverHeight to work in the region I am in on Kitely (Australian Homelands). I read (http://opensimulator.org/mantis/view.php?id=6818) that this function has only been implemented in the ubOde physics engine, but I am not sure what engine is being used in Australian Homelands.

In addition to the above problem I guess the fact is that not many people want to swim in OpenSim (or at the very least, don't want a wearable swimming HUD). For me that's a huge shame as one of my greatest delights in SL is swimming and scuba diving. It's also frustrating because Australian Homelands are some of the most beautiful regions I have ever seen in SL or OpenSim (I am biased as I am Australian and they are soooo realistic) and have beautiful water to swim in.

I wonder if there is anything Kitely can do about making a swimming HUD available?

Anyhow, thanks again! :)

Kaylee
These users thanked the author Kaylee West for the post (total 3):
Chris NamasteGraham MillsZyzzyx Qinan
Post Reply