Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sculpty animation avi kick off. Help please

Carl Temin
Registered User
Join date: 29 Sep 2006
Posts: 39
07-08-2007 06:45
Hello all,

I have an aircraft using the script below. However, i have made the craft using sculpties.
Now, i want to animate one of the sculpties linked to the root prim using a simple listen command. I works great. But, when i sit on and fly the aircraft ans then send the message 'fly' which causes the sculpted prim to change shape 'I get kicked off the craft and the physics stops and the craft stops' just as if i stood up. And i cannot figure out why.

Can anyone help please
Carl Temin
Registered User
Join date: 29 Sep 2006
Posts: 39
and these are the scripts,
07-08-2007 06:49
Sorry forgot to include the scripts

// heavily commented script by: jester Knox
// please IM him with any problems, corrections, or improvements you find.
// if you use this for a vehicle you wish to sell, or you just think is really cool
// please send me a copy, i really like vehicles.
// charging for this script is forbidden. it is meant to be a learning tool to
// be freely passed along.

vector linear = <0, 0, 0> ; // declare the value for the linear motor
vector angular = <0, 0, 0> ; // declare the value for the angular motor



default
{
state_entry()
{



// what the pie menu says if you want to get in
llSetSitText("Drive";) ;

// hearing collision sounds when on the ground would suck, so we mute them.
llCollisionSound("", 0.0) ;

// where the AV sits (this assumes that the root prim is the drivers seat)
llSitTarget(<0.1, 0.0, -0.70>, ZERO_ROTATION) ;

// readjust the camera so the driver can see
llSetCameraEyeOffset(<-10.0, 0.0, 2.0> ) ;
llSetCameraAtOffset(<3.0, 0.0, 1.0> ) ;

// define the vehicle as a vehicle and what kind it will be
// possibilities inclide:
// VEHICLE_TYPE_SLED
// VEHICLE_TYPE_CAR
// VEHICLE_TYPE_BOAT
// VEHICLE_TYPE_AIRPLANE
// VEHICLE_TYPE_BALLOON
// if this script is unmodified from its original form the settings
// and controls are assuming a flying craft.
llSetVehicleType(VEHICLE_TYPE_AIRPLANE) ;

// linear friction: friction on a straight line x,y,z planes.
// or how long it will take to stop moving on each axis
// (not a measure of time as far as i can tell).
// higher numbers give less friction. max value = 1000
llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TI MESCALE, <100.0, 100.0, 100.0>;) ;

// angular friction: resistance to turning
// or how easy it is to twist, and how long it will take to level off
// (not a measure of time as far as i can tell).
// higher numbers give less friction. max value = 1000
llSetVehicleFloatParam(VEHICLE_ANGULAR_FRICTION_TI MESCALE, 100.0) ;

//linear motor: as motor implies the push that makes your craft go

// the linear velocity that the craft attempt to achieve. max = 40
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIREC TION, <100.0, 100.0, 100.0>;) ;
// the time it takes to reach top speed min = 0.06
llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESC ALE, 1.0) ;
// time during which the motor's effectiveness exponentially decays max = 120
llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_ TIMESCALE, 2.0) ;

// angular motor: motor that twists the path of the craft

// angular velocity (radians/sec) that the vehicle will try to rotate.
// max = 4*PI (2 revolutions/sec)
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRE CTION, <100.0, 100.0, 100.0>;) ;
// the time it takes to be spinning at full speed. min = 0.06
llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMES CALE, 1.0) ;
// time during which the spin exponentially decays max = 120
llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY _TIMESCALE, 2) ;


// time for craft to stabilize at hover height
// **values greater than 300 disable hover**
llSetVehicleFloatParam(VEHICLE_HOVER_TIMESCALE, 360.0) ;
// height to hover at. what craft will use as the base height
// to base this from depends on the flags set
// VEHICLE_FLAG_HOVER_WATER_ONLY
//| VEHICLE_FLAG_HOVER_TERRAIN_ONLY
//| VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT
// we will set these (or not) later
llSetVehicleFloatParam(VEHICLE_HOVER_HEIGHT, 0.0) ;
// min = 0.0 max = 1.0
// 0.0 = bouncey 1.0 = smooth
// how tightly the craft adheres to the hover height
// timescale will be the oscillation period of the bounce.
llSetVehicleFloatParam(VEHICLE_HOVER_EFFICIENCY, 0.0) ;
// 0 = normal phsycs apply
// 1 = anti-gravity, the force of gravity will not apply
// -1 = adds extra gravity to craft
llSetVehicleFloatParam(VEHICLE_BUOYANCY, 0.98) ;



// linear deflection: any push from any angle will attempt to be
// redirected along the axis that the craft wishes to go (forward)
// i.e. a car will want to go in the direction its wheels are facing

// time till craft moves in direction of outside push
llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_T IMESCALE, 1.0) ;
// no deflection = (0.0) max deflection = 1.0
llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_E FFICIENCY, 0.5) ;



// angular deflection: an outside push will attempt to reorient craft
// to match direction of push.
// i.e. a collision from the side will turn the craft to point
// the same direction as the impact was going.

// time till craft twists to match direction of outside push
llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_ TIMESCALE, 100.0) ;
// no deflection = (0.0) max deflection = 1.0
llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_ EFFICIENCY, 0.25) ;


// vertical attraction: keeps the top side up
// i.e. the x axis of the craft is locked to the world x axis

// set above 300 to disable
llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION _TIMESCALE, 1.0) ;
// min = 0.0 = wobbly max = 1.0 = steady
llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION _EFFICIENCY, 0.75) ;
// * Note that by default the vertical attractor will prevent the craft
// * from diving and climbing. So, if you wanted to make a airplane you
// * would probably want to set the VEHICLE_FLAG_LIMIT_ROLL_ONLY flag
// * to allow pitch (nose up/down)

// amount of lean during turns
// min = -1 lean out of turns max = 1 lean into turns
llSetVehicleFloatParam(VEHICLE_BANKING_EFFICIENCY, 0.1) ;
// min = 0 = static max = 1 = dynamic
// i have no clear idea what this does, in some way it effects
// the craft banking while stopped and moving
llSetVehicleFloatParam(VEHICLE_BANKING_MIX, 1.0) ;
// time to reach the full tilt of the banking
llSetVehicleFloatParam(VEHICLE_BANKING_TIMESCALE, 360.0) ;

// 2 possible uses.
// if your root prim is *not* <0,0,0> you can use this to orient your
// craft correctly
// or if you need to change the orentation of your craft.
// i.e. to tilt up on end for a take off/landing mode.
// typically you should not need to set this to anything
llSetVehicleRotationParam(VEHICLE_REFERENCE_FRAME, <0.0, 0.0, 0.0, 1.0>;) ;


// flags to set special attributes or behaiviors to the craft

// VEHICLE_FLAG_NO_DEFLECTION_UP Prevents linear deflection parallel to the
// world-z axis. or in plain english linear deflection will not push up
// VEHICLE_FLAG_LIMIT_ROLL_ONLY Removes vertical attraction for changes in
// vehicle pitch allows craft that use vertical attraction to nose up/down
// VEHICLE_FLAG_HOVER_WATER_ONLY Hover only pays attention to water level
// hover keeps craft at a fixed height above the water height (ignoring terrain height)
// VEHICLE_FLAG_HOVER_TERRAIN_ONLY Hover only pays attention to terrain height
// hover keeps craft at a fixed height above the terrain height (ignoring water height)
// VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT Hover only pays attention to global height
// hover at global altitude ignoring terrain and water levels
// VEHICLE_FLAG_HOVER_UP_ONLY Hover only pushes up
// hover will not push down, hover height will be the lowest the craft can go
// VEHICLE_FLAG_LIMIT_MOTOR_UP Prevents ground vehicles from motoring into the sky
// keeps ground craft from flying up or steering midair
//
// VEHICLE_FLAG_MOUSELOOK_STEER Makes vehicle try to turn toward mouselook direction
// VEHICLE_FLAG_MOUSELOOK_BANK Makes vehicle try to turn toward mouselook
// direction assuming banking is enabled
// VEHICLE_FLAG_CAMERA_DECOUPLED Causes the camera look-at axis to NOT
// move when the vehicle rotates


// flags we are not applying to this craft.
// may be unneccessary unless craft will change flags when entering different modes
// but seems like a good idea o have them anyway. if the craft will change modes
// i.e. enter a staet to be a car not an airplane then you would remove the airplane
// type flags and add car type ones.
llRemoveVehicleFlags(VEHICLE_FLAG_NO_DEFLECTION_UP
| VEHICLE_FLAG_HOVER_WATER_ONLY
| VEHICLE_FLAG_HOVER_TERRAIN_ONLY
| VEHICLE_FLAG_LIMIT_MOTOR_UP
| VEHICLE_FLAG_LIMIT_ROLL_ONLY
|VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT
| VEHICLE_FLAG_HOVER_UP_ONLY) ;


// flags we are applying to this craft
//llSetVehicleFlags(VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT
// | VEHICLE_FLAG_HOVER_UP_ONLY) ;

// keeps craft from moving on rez before driver/pilot is seated
llSetStatus(STATUS_PHYSICS, FALSE) ;
}


// now that the charistics of the craft's handeling are set we need to
// add the ability to controll the craft

on_rez(integer param)
{
llResetScript();
}


// checks to make sure that the craft owner is the the driver/pilot
// by seeing if the links have changed. an AV sitting on something changes
// the link status and we are detecting that here.
changed(integer change)
{
if (change & CHANGED_LINK)
{
// get the key of the AV sitting down
key agent = llAvatarOnSitTarget() ;
if (agent)
{
if (agent != llGetOwner())
{
// only the owner can use this craft. if you are not the owner
// the craft will say...
llSay(0, "You aren't the owner -- only the owner can drive this craft.";) ;
// then stand you up
llUnSit(agent) ;
// and give you a bit of a shove out of the craft
llPushObject(agent, <0,0,10>, ZERO_VECTOR, FALSE) ;
}
else
{
// if you are the owner you are permitted to sit.
// and we reset the linear motor to keep the craft at a stop.
linear = <0, 0, 0> ;
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIREC TION, linear) ;


llSetVehicleFloatParam(VEHICLE_LINEAR_FRICTION_TIM ESCALE, 100.0) ;
llSetVehicleFloatParam(VEHICLE_ANGULAR_FRICTION_TI MESCALE, 100.0) ;
// gets permission to make the driver/pilot use the sit anim and
// take over the controls
llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS) ;
}
}
else
{
// if the drive/pilot stands up we want to stop the craft so
// it dosent wander off.
linear = <0, 0, 0> ;
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIREC TION, linear) ;
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRE CTION, linear) ;
// angular isnt linear, but its one less vector we need to define

// here we use friction to stop the vehicle very quickly
// rather than llSetStatus(STATUS_PHYSICS, FALSE) ; which
// will work but be far more abrupt.
llSetVehicleFloatParam(VEHICLE_LINEAR_FRICTION_TIM ESCALE, 1.0) ;
llSetVehicleFloatParam(VEHICLE_ANGULAR_FRICTION_TI MESCALE, 1.0) ;

// driver/pilot is no longer at the controls, so we stop acting on them
llReleaseControls() ;
// and we dont need them sitting anymore, as they are standing up
llStopAnimation("sit";) ;
// and we make the craft non-phsycal to keep it from being moved away.
// this also cuts down the load on the sim if you wish to park somewhere.
llSetStatus(STATUS_PHYSICS, FALSE) ;
}
}

}



// script grants self permissions to act on control inputs
run_time_permissions(integer permissions)
{
if (permissions & PERMISSION_TAKE_CONTROLS)
{
// these are all the possible controls to act on
llTakeControls( CONTROL_FWD
| CONTROL_BACK
| CONTROL_LEFT
| CONTROL_RIGHT
| CONTROL_ROT_LEFT
| CONTROL_ROT_RIGHT
| CONTROL_UP
| CONTROL_DOWN
| CONTROL_LBUTTON
| CONTROL_ML_LBUTTON,
TRUE, FALSE) ;
// what are true and false doing here?
// the first one is refering to accepting controlls,
// you want this on in most cases.
// the second value is pass_on. what that means is that
// it is asking if the commands are sent to the AV also
// or just the vehicle. if CONTROL_ML_LBUTTON is used
// it will make a mouselook button appere on the bottom
// of the screen, but only if the second true/false is
// set to false.

// turn physics on so we can move
llSetStatus(STATUS_PHYSICS, TRUE) ;
}
}

// if each control is pressed, what the craft's responce is.
control(key name, integer level, integer edge)
{


// there are 4 different states of each controll button
// it can be either up or pressed down
// or being pressed or realesed
// yes there is a difference.
// i.e. if the up arrow means go forward and held down means go
// then as long as the key is held down it will go and when it is realesed
// then that command will stop.
// if pressed means go then if you tap the up arrow it will go untill
// there is another command to tell it not to.
// or in other words edge fwd can mean go
// not edge fwd can mean stop
// then you will only go fwd when the button is down
//
// sorta, its confusing
//
// level means the button is down
// !level (not level) means the button is up
// edge means the button is being pressed or realesed
// !edge (not edge) means the button has not been touched
// so the act of perssing and then releasing the button would be
// edge & level, !edge & level, edge & !level, !edge & !level
//
// that may be an over simplification, and may be misleading.




// it should be noted that i didn't put any speed limits in the script in
// the interest of clarity and keeping things simple to follow.
// that gives the craft a max speed of about 40 m/s.
// 40 m/s is usually too fast for an enjoyable ride, but fast can be lots of fun.


// when the up arrow or w is pressed
if (level & CONTROL_FWD)
{
// if we are moving backwards stop
if (linear.x < 0)
{
linear.x = 0 ;
}
// otherwise go forward
else {linear.x += 14.0 ; }
}

// when the up arrow or w is released
else if ((edge & ~level & CONTROL_FWD))
{
linear.x = 0 ;
}

// when the down arrow or s is pressed
if (level & CONTROL_BACK)
{
// if we are moving forward stop
if (linear.x > 0)
{
linear.x = 0 ;
}
// otherwise go backwards
else
{
linear.x -= 14.0 ;
}
}

// when the down arrow or s is released
else if ((edge & ~level & CONTROL_BACK))
{
linear.x = 0 ;
}
// when shift and the left arrow or shift and a is pressed
if (level & CONTROL_LEFT)
// strafe left
{
linear.y += 8.0 ;
}

// when shift and the left arrow or shift and a is released
else if (!(level & CONTROL_LEFT))
// stop strafeing left
{
linear.y = 0 ;
}

// when shift and the right arrow or shift and d is pressed
if (level & CONTROL_RIGHT)
// strafe right
{
linear.y -= 8.0 ;
}

// when shift and the right arrow or shift and d is released
else if (!(level & CONTROL_RIGHT))
// stop strafe right
{
linear.y = 0 ;
}

// when the left arrow or a is pressed
if (level & CONTROL_ROT_LEFT)
// turn left
// tilt slightly
{
angular.z += (PI / 180) * 55.0 ;
// turn
angular.x -= PI * 4 ;
}

// when the left arrow or a is released
else if ((edge & ~level & CONTROL_ROT_LEFT))
// stop turning
// level off
{
angular.z = 0 ;
// stop turning
angular.x = 0 ;
}

// when the right arrow or d is pressed
if (level & CONTROL_ROT_RIGHT)
// turn right
// tilt slightly
{
angular.z -= (PI / 180) * 55.0 ;
// turn
angular.x += PI * 4 ;
}

// when the right arrow or d is released
else if ((edge & ~level & CONTROL_ROT_RIGHT))
// stop turning
// level off
{
angular.z = 0 ;
// stop turning
angular.x = 0 ;
}

// when page up or e is pressed
if (level & CONTROL_UP)
// move up
{
linear.z += 48.0 ;
}

// when page up or e is released
else if (!(level & CONTROL_UP))
// stop moving up
{
linear.z = 0 ;
}

// when page down or c is pressed
if (level & CONTROL_DOWN)
// move down
{
linear.z -= 24.0 ;
}
// when page down or c is released
else if ((edge & ~level & CONTROL_DOWN))
// stop moveing down
{
linear.z = 0 ;
}

// the following commented out for lack of a good use in my basic example
// however these are valid controlls and usefull in many kids of craft.

// when the left mouse button is pressed while in mouselook
//if ((level & CONTROL_ML_LBUTTON) && (edge & CONTROL_ML_LBUTTON))
//llOwnerSay ("CONTROL_ML_LBUTTON - pressed";);
// when the left mouse button is released while in mouselook
//if (!(level & CONTROL_ML_LBUTTON) && (edge & CONTROL_ML_LBUTTON))
//llOwnerSay ("CONTROL_ML_LBUTTON - released";);

// when the left mouse button is pressed
//if ((level & CONTROL_LBUTTON) && (edge & CONTROL_LBUTTON))
//llOwnerSay ("CONTROL_LBUTTON - pressed";);
// when the left mouse button is released
//if (!(level & CONTROL_LBUTTON) && (edge & CONTROL_LBUTTON))
//llOwnerSay ("CONTROL_LBUTTON - released";);

// allows us to alter the speed based on the pilot/driver's input
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIREC TION, linear);
// lets us turn
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRE CTION, angular);
}
}
[/PHP]


and for the sculpty animation

[/PHP]
default
{
state_entry()
{
llListen(0,"",,"";);
llListen(111,"",llGetOwner(),"";);
}

on_rez(integer start_param)
{
llResetScript();
}

listen(integer channel, string name, key id, string message)
{
if (id == llGetOwner())
{
if (llToLower(message)=="land";)
{
llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_SCULPT, "UUID", PRIM_SCULPT_TYPE_SPHERE]);
}

if (llToLower(message)=="fly";)
{
llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_SCULPT, "UUID", PRIM_SCULPT_TYPE_SPHERE]);
}
}
}

}
[/PHP]

Many thanks for all in advance

Carl
Carl Temin
Registered User
Join date: 29 Sep 2006
Posts: 39
Not the script
07-08-2007 07:09
Hi again,

I should have checked this before i did it. IT IS NOT THE SCRIPTS

Any sculpty change in shape seems to kick off a sitting avi.....why? does any one know?


Regards Carl
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
07-08-2007 07:34
Annoying, huh? See .
Carl Temin
Registered User
Join date: 29 Sep 2006
Posts: 39
hmmm
07-08-2007 09:03
That being the case, i wonder if there is any other way of setting the parameters, maybe a different command?
Anyone know?

Regards

Carl
whyroc Slade
Sculpted and Blended
Join date: 23 Feb 2007
Posts: 315
07-08-2007 09:39
This happens with normal prims too, if you are sitting on a sphere and change to cube.... boing!

you could make the 'seat' of the plane as an object that doesn't change during the animation, might work.


-whyroc
_____________________
Sculpt Maps Galore - 100's of full perm sculpt maps. Top quality sculpts - low prices.
http://slurl.com/secondlife/Poecila/50/54/92
Zen Zeddmore
3dprinter Enthusiast
Join date: 31 Jul 2006
Posts: 604
07-08-2007 09:47
you CAN however WEAR a sculpty that's animated. Hope that's any help. BTW sounds like an intresting build, any chance to see it in action?
_____________________
A kilogram of programmable nanobots can lower the certainty of both death AND taxes.
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
07-08-2007 13:49
Anytime you're sitting on a physical object, and something changes which might cause the mass of the physical object to change... then the avatar gets kicked-off. You can move and rotate linked prims within a physical set while sitting... but you can't cut, hollow, or resize them without getting kicked-off.

I'm not 100% sure about re-sizing... in the past, I resized and got kicked-off. Recently, I tried both llSetScale() and llSetPrimitiveParams() to re-size a child prim and it just didn't work at all (and I didn't get kicked).


P.S. - you can delete your script post, that's a long post to scroll through now that it's irrelevent.
Boss Spectre
Registered User
Join date: 5 Sep 2005
Posts: 229
07-08-2007 14:22
Whether it changes mass or not, whether the object is physical or not, using the PRIM_TYPE parameter of llSetPrimitiveParams() for ANY linked prims is what unseats you. It's unfortunate that sculpt textures were implemented this way, because I don't think they change the mass at all, since they are done client-side. (Haven't tested this to be sure)

You can however use PRIM_SIZE or llSetScale() if you first turn off physical.

In this case, turning off physical is likely not an option because it will kill your velocity. One solution might be to use alpha transparency and multiple prims to swap out which are visible, depending on how many prims you need to change.
Carl Temin
Registered User
Join date: 29 Sep 2006
Posts: 39
Thanks
07-09-2007 02:35
Thanks folks

Thank you all for the help.

Zed, i shall im you to come see it, it is finished ( i just change the shape before i sit on it.

And, as for deleting the long script...sorry, i would if i knew how :(

As for using alpha's, i would if i had any prims to play with ie <30.

Thanks again to you all.

Regards

Carl
FatBear Flamand
Registered User
Join date: 9 Dec 2006
Posts: 4
09-10-2007 18:21
From: Carl Temin
That being the case, i wonder if there is any other way of setting the parameters, maybe a different command?



Hi Carl

If number of prims permit, cant you have two prims, one invisible and phantom, one visible non-phantom that alternate these parameters when you send the command?
Have no hint if this can work, its just an idea... (:


{}Overtake
_____________________
{}Overtake