Palette Reference – 12 – Thrower – Part 8 – MaterialsOnCollide

MaterialsOnCollide

Use this to alter the behavior of the Palette due to material properties changing after a collision.

you MUST specify them in this order.

Gravity, Friction, Density, Bounciness

Gravity – Range [-1.0 28.0]
Friction – Range [0.0 – 255.0]
Density – Range [1.0 – 22587.0]
Bounciness – Range [0.0 to 1.0]

Example:
MaterialsOnCollide,on,0.2,10.0,10.0,0.1

Palette Reference – 11 – Thrower – Part 7 – ControlOnCollide

ControlOnCollide

ThrowOnCollide must be NOT BE ZERO. At least 1,2, or 3.
Ex: ThrowOnCollide,1

Use this to control another Palettes actions to occur, subsequent to your initiating Palette (the one sending the ControlOnCollide command.

Use commas “,” to separate parameters instead of “%” like in *autofx.

Begin with the Palette name to be controlled followed by the action and parameters.

Example:   ControlOnCollide,on,SoccerBall4.Hide,ALL,3.0

You can specify a delay using the ControlOnCollideDelay if you need to time the triggering of the 2nd Palettes command.
Example: ControlOnCollideDelay,5.8

Palette Reference – 10 – Thrower – Part 6 – Collisions

Collisions are where the real magic happens with Thrower Palettes.

Many actions can happen upon a Palette colliding with another object because we can be so “precise” with this trigger.  A simple minor adjustment of the collision-triggering-object can change the timing just a smidgeon.

Only a physical object will receive a collision events from colliding with a non-physical object.

CollisionPostActions(1/2/3) MUST be “on” for 1 thru 8 below to occur. If more than 1 CollisionPostAction is on then ONLY the lowest one executes.  Ex: 1 if 1 and 2.  2 if 2 and 3. 1 if 1 and 3.

IMPORTANTThrowOnCollide,(1/2/3) ALWAYS executes and acknowledges respective CollisionPostAction2 , CollisionPostAction3, ApplyImpulse(2/3), and AngularVelocity(2/3).  All other parameters apply the same as for ThrowOnCollide.  That is, ThrowOnCollide2 respects ApplyImpulse2 and AngularVelocity2

***********************
The following commands affect the Palette containing the *thrower nc

1 = SetMatchPosOnCollide,(on/off) – Thrown Palette matches position of Target

2 = SetMatchRotOnCollide,(on/off) – Thrown Palette matches rotation of Target

3 = SetStopSpinAtTarget,(on/off) – Thrown Palette Stop spinning via a TargetOmega (client-side spin)

4 = SetNonPhysOnCollide,(on/off) – Makes Thrown Palette NON-PHYSICAL

5 =  AttachOnCollide,(on/off) – Attaches thrown palette  to body-part of granter of Attach permissions. Attachable ability must be ‘on’.  Use ResetSit as needed.

6 = DieOnCollide,(on/off) – Deletes/Kills the Palette owning the *thrower nc

7 =  ControlOnCollide,(on/off) – Control an action in another named Palette

8 = MaterialsOnCollide,(on/off) – Changes Gravity,Friction,Denisty, and Bounciness

9 = ThrowOnCollide,(1/2/3) – This DOES NOT NEED a CollisionPostAction,(1/2/3)  to be ON.  It will ALWAYS trigger a throw but that throws collision IS determined by CollisionPostAction

Palette Reference – 09 – Thrower – Part 5 – Targeting

Targeting

There are a many variables involved in targeting that can prove challenging when creating a targeting type throw.

#1-REQUIRED

You have to specify a TARGET:

ThrowerTarget,(off/Object/Avatar)
ThrowerObjectTargetName,HatTarget  —  example
ThrowerAvatarTargetName,Lat Lovenkraft —  example – this can be used by some catching a thrown object

#2-REQUIRED

You MUST set MoveToTarget,on

#3-RECOMMENDED

MoveToTargetTau,1.0 — how fast the Target is approached

#4-RECOMMENDED

AtTargetRange,0.1  — how close the Palette has to be to the target in order to trigger PostRange events.

#5-OPTIONAL

You can set the following on or off.  They determine what happens when the Palette enters the specified range from the target.  When it is within the range.  Less than the range distance from the target.

AttachOnRange,on,6
SetNonPhysAtTarget,on
SetMatchPosAtTarget,on
SetMatchRotAtTarget,on
SetStopSpinAtTargert,on

******************************

Important:  If ThrowerTarget is NOT off then a
thrown palette, when in range of a target, will always:

1 – STOP moving from any MoveToTarget
2 – STOP moving from any ApplyImpulse
3 – STOP turning from any TargetOmega
4 – STOP turning from any AngularVelocity

 

 

 

Palette Reference – 08 – Thrower – Part 4 – Stopping

There are 3 ways to TERMINATE/STOP a thrown palette.

1 – DO NOTHING – and it will FALL to the ground, if it is physical, which it almost always is upon a throw.  Apply Impulse and MoveToTarget both cause the Palette to turn physical.
One aims in a direction, the other aims at  a specific target, be it object or avatar.

2 – Make the palette STOP as soon as it collides with another object.  SetNonPhysOnCollide,on will cause a thrown palette to turn NON-PHYSICAL as soon as it comes in contact with any object or avatar.

3 – Make the palette STOP as soon as it comes within “range” of a specified object or avatar. First make the palette target an object or avatar using SetMoveToTarget,on.  Next, tell the thrower how close it must come to be AT the target using AtTargetRange. And finally, make the palette STOP as soon as it comes within “range” of the specified target by specifying SetNonPhysAtTarget,on Be sure ThrowerTarget is set t Object or Avatar and not OFF.

You can only choose 1 of the 3 methods:

#1
PostActionCollision,off
 PostActionRange,off

#2
PostActionCollision,on
PostActionRange,off

#3
PostActionCollision,off
PostActionRange,on

 

Palette Reference – 07 – RezObj/Die

You can rez an object that is inside of a palette by specifying its full name, case-sensitive, using the RezObj command.  It can be thought of as a poor-mans thrower.  

It should be copyable.

You need build rights.

To propel it, it needs to be PHYSICAL.  You can also make it Temporary if that works for you

If propelling, then adjust its GRAVITY downward to Iess than 1.0)  to make it go further. (think moon).

You must rez the object within 10 meters of the Palette.

02_A%RezObj%NameOfObjectToRez%<1##1##1>%<0##0##0##1>%<1##0##0>%1

<1##1##1> = rez at position <x,y,z>  — must be within 10 meters of center of root prim as the crow flies

<0##0##0##1>= rez  with rotation <x,y,z,s>  — I have always used <0##0##0##1>

<1##0##0> = velocity direction <x,y,x> — this can be directly translated into ApplyImpulse on Thrower 

%1 = unused but could be implemented using a custom script in the thrown object to react post-throw.

 

NEW! March 2021 – On the *utility nc
SetNonPhysOnCollide,on — This will cause rezzed object to go non-physical upon collision.  You need at least Palette v33.
This is essentially a poor-mans quick-and-dirty Thrower.  (I used this to construct an arrow-to-target scenario. ) As in, no final matching dispositions. No built-in mechanisms for throw/catch.

*******************
The Die command will delete a Palette.  The Palette MUST be scripted as a normal palette…a sometimes overlooked requirement..
No abilities required,

02_A%Die%  — this will delete a Palette named 02_A.  It must be rezzed and in world.  Be careful that you do not delete the only copy of a no-copy object.

 

Palette Reference – 06 – Thrower – Part 3 – Rotation

There are 2 ways to specify a rotation amount. AngularVelocity and
TargetOmegaTargetOmega occurs client-side.

******************
AngularVelocity

Basically, a rotation amount determines how fast a rotation occurs around one or more axis. (x,y,z).  Each axis has its own speed.  It is in radians per second.  There are about 57 degrees in a radian so if you want one revolution per second then you need about 6 radians or more specifically 2-pi which is 6.283.

So to rotate around an x axis once per second you would need an AngularVelocity of <6.283,0,0>
Twice per second would be:  <12.566,0,0>

The chosen axis, usually just 1, determines whether the flight is more frisbee-like or more end-of-end (think football field-goal flight) depending on orientation.

SetAngularVelocity ignores mass.
SetAngularVelocity will slow down overtime.

******************
TargetOmega

SetTargetOmega will NOT slow down overtime. Its rotation is constant.

Example:
TargetOmega,<1.0,0,0>,6.283185,2

Where:
<1,0,0> =  the axis of rotation, usually  just one. <-1,0,0> will reverse the direction of the rotation/spin.

6.283185 = is the radians of revolution per second

2 = gain which is a multiplier of the radians.  So 2 is twice 6.23185 or 2 revolutions per second.  a value of zero would stop the revolution.

******************

We need to flip a switch to tell the Thrower program with method we are choosing.  We cannot choose both.

The switches in the *thrower nc are called:
SetAngularVelocity,(on/off)
SetTargetOmega,(on/off)

Palette Reference – 05 – Thrower – Part 2 – Propulsion

There are 3 ways to propel a thrower-object.

1) Impulse – mass-influenced – untargeted
2) Velocity – non-mass-influenced – untargeted
3) Move-To-Target – targeted

We focus on Impulse because it looks the best but is also the hardest to create. The 2nd most useful would be Move-To-Target

Mass is influenced by: Gravity, Friction, Density, Bounciness
Gravity and Density balance each other out meaning you only need to modify either one but never both when using Impulse.

Note: The palette when thrown, turns PHYSICAL upon initial release of a throw.

I usually just change Gravity up or down. Usually down, less than 1.0  in order to make a loftier throw with more of an arc.

A good starting point is an impulse vector of <0,2.0,2.66>,  This will give you a near 45 degree arc.  So this means setting the ApplyImpulse entry on the *thrower nc to <0,2.0,2.66> and changing  SetApplyImpulse,on will create a nice basic throw when you issue a throw1 command.

ApplyImpulse ,<0,2.0,2.66>
SetApplyImpulse,on

Changing entries on the *thrower nc requires a reset of the Palette.

There are Palette menu buttons for testing throw arcs by using the
ImpulseOnOff toggle and ApplyImpulse buttons.  They do the same thing as the 2 *thrower nc entries discussed above

Experimentation is the best way to achieve a desire arc and landing point. Your 1st time will be the hardest. Then it will get easier and easier.  Getting the right impulse vector is the  hardest part of creating a thrower. Everything else is easier.

Non-Essential Background Info follows:

An impulse of <1.0,0,0 > gives your Palette an INSTANTANEOUS 1-second thrust (momentum against center-of-mass) in an x-y-z direction of magnitude(size)  x-y-z.  In this case, <1,0,0> direction is in the local x direction.  For the Thrower, we currently only use local coordinates (local is object relative).  

Would you rather be hit by a basketball going 20 miles an hour or a train going 20 miles an hour.  If you answered basketball, then you understand magnitude.

Palette Reference – 04 – Thrower – Part 1 – Overview

Artiste Thrower

A throw is meant to provide the ability for a performer to interact with propelled objects.

You could sail an object across a room like a frisbee.  You can land an object onto another object.  You can stop an object in mid-flight.  You can propel an object, causing it to knock over one or more objects.   You can case a propelled object to break another object into pieces. You can tumble an object end-over-end.  You could bounce an object off the floor.  You can catch a thrown object using a ‘catcher-like’  feature or the attach feature.  You can change speeds in mid-flight.   It is bounded only by your imagination.

A throw command starts a throw sequence.  A throw is the propelling of an object based on either gravity or a targeting.

Gravity causes more of an arc in the trajectory while targeting presents a near-flat trajectory.

It offers a choice of propulsion methods, rotation methods,  in-flight options, and termination-dispositions.  Its power comes from using invisible objects to cause collisions at specific times in order to trigger extra events as well as its ability to attach to an avatar.

The specifications of a throw are based upon:
1) entries on the *thrower nc
2) the use of contraptions, otherwise known as unscripted non-physical objects, properly-placed.
3) well-timed triggering of one or more throw commands.
4) one or more animations that help sell the throw and/or catch of the feature.

Although you can do a basic throw/toss of an object, you can also: land, carom, boomerang, catch, bounce, stop-action, ricochet, kickshoot, dribble, as hinted at earlier on.

There are 3 sets of primary commands throw1, throw2, and throw3 that determine which pair of velocity./rotation pairs will start a throw sequence.

A throw sequence consists of:
1) movement
2) rotation
3) cessation
4) ending disposition
5) termination concesquences

Format:

02_A%throw1this will throw palette 02_A using the entries on the *thrower nc called:
ApplyImpulse and AngularVelocity. This is the one (throw1) you will use most of the time.  Using a 2nd throw, say throw2, would be in a palette that was thrown from throw1 and it would use ApplyImpulse2 and AngularVelocity2, assuming you chose gravity and not targeting.

Most important is to ‘have a good reason’ to use a throw and a proper context.  Second most important is your imagination as to how to present and incorporate a throw into your routine at the right time and place.

Below are the entries on the *thrower nc.  Learn them on a need-to-know basis.

*thrower nc

TRACE,off

/**** Thrower ****
AutoReturn,10
Boomerang,off
BoomHoverDelay,1.0
CollisionPostActions1,off
CollisionPostActions2,off
CollisionPostActions3,off
IgnoreFirstCollision,off
RangePostActions,off
/* ThrowingBodyPart 2=Skull,5=LHand,6=RHand,7=LFoot,8=RFoot
Receiver,0
RemoveFolder
RemoveFolderDelay
RezMe,off
Richochet,off
ShowInMidFlightAfter,0.25
TempRezMe,off
ThrowOnCollide

/* Rezzer
Rezzer,off
RezInvisiDelay
RezObjectName
RezSource
Thrower0123OnRez

/* Targets ThrowerTarget=Object/Avatar/Both/off – avatar must be Owner for owner
DirectionalVector,Local
ThrowerTarget,off
ThrowerObjectTargetName1,HatTargetB1
ThrowerObjectTargetName2,HatTargetB2
ThrowerAvatarTargetName

/*Motions – only one usually
SetApplyImpulse,off
/*llApplyImpulse(llGetMass()*<0,2.0,2.66>,TRUE);
ApplyImpulse,<0,1.0,1.0>
ApplyImpulse2,<0,-0.5,1.5>
ApplyImpulse3,<0.0,-8.0,6.0>
SetMoveToTarget,off
/* Make Tau smaller for more rushed following
MoveToTargetTau,2
AtTargetRange,0.5
SetVelocity,on
Velocity,<0,2,2.66>

/*rotations – only one
SetAngularVelocity,off
AngularVelocity,<0.0,0.0,0.0>
AngularVelocity2,<0.0,0.0,0.0>
AngularVelocity3,<0.0,0.0,0.0>
/*PreOrientRot,off
SetTargetOmega,off
/*StartRotOffset,(Full/Half)
/*llTargetOmega(<1.0,0.0,0.0>,TWO_PI,2.0);
TargetOmega,<1.0,0.0,0.0>,6.283185,2.0>

/*Posts Collision
AttachOnCollide,off,5
/*ControlOnCollide,on,SoccerBall4,Hide,ALL,3.0
ChatOnCollide,off
ChatOffCollide,off
ControlOnCollide,off,SoccerBall4,detach
ControlOnCollideDelay
DieOnCollide,off,1.5
MakePhysAfterPost,0
MaterialsOnCollide,off,0.2,10,10,0.1
SetMatchPosOnCollide,off
SetMatchRotOnCollide,off
SetStopSpinOnCollide,on
SetNonPhysOnCollide,on

/*Posts Target
AttachOnRange,off,6
SetMatchPosAtTarget,on
SetMatchRotAtTarget,on
SetStopSpinAtTarget,on
SetNonPhysAtTarget,on

/*Post Matrix
SetMatrix,on
MatrixSpeedFactor,3.0
MatrixDelay,1.0
MatrixNonPhysAfterWait,2.0

/*Follower
/* FollowTargetType (Avatar/Object/Troupe/Owner)
/* MoveToTargetTau
/* AtTargetRange
Follow,off
FollowNameOrKey,Name
FollowName,Lat Lovenkraft
FollowTargetType,Avatar
FollowKey
/* FollowerDelay seconds between blinks; lower for more lag
FollowerDelay,0.5
FollowPhantom,off
ObjectToFollow
END
/*DirectionalVector,(Local/World)

 

 

Palette Reference – 03 – Flasher

This feature glows on and off the full set of links in a link-set using the current colors and textures;

Requires the Utility Script.
No Abilities required.

paletteName/abbrev%flasher%(on/off)%glow-amount%glow-rate%glow-duration

glow-amount, glow-rate, and glow-duration are optional

Ex:

02_A%flasher%on — uses defaults
02_A%flasher%off

02_A%flasher%on%0.3 — uses defaults glow-rate & glow-duration
02_A%flasher%on%0.4%0%0.2 –– this will use default glow-rate
02_A%flasher%on%0.0%0.02%0.2 — uses default glow amount

Defaults are: 
glow-amount =  0.2
glow-rate =  0.01
glow-duration = 0.1