« Return to Thread: Repulsion between physical and other objects

Re: Programming a natural looking swing (was Repulsion between physical and other objects)

by Hidenori GOTO :: Rate this Message:

Reply to Author | View in Thread

Hi, this is a swing I built using llRotLookAt. (non-physical)

http://youtube.com/watch?v=CO2z4meDKCw

secondlife://galonge/51/44/26/



Hidenori Glushenko
http://blog.innx.co.jp/


2008/9/5 Tigro Spottystripes <tigrospottystripes@...>:

> wow! looking values up on a list is faster and easier on the sim than doing
> math?! 0.0
>
> some other time I'm gonna try to make a non-phys swing that will take
> controls to let the "rider" swing back and forth, calculating in realtime
> the new speeds, and I'll probably  use that arbitrary pivot trick with
> llSetPrimitiveParams instead of offseting the actual center of rotation of
> the linkset just for kicks Xp
>>>
>>>    AnnMarie@... wrote:
>>>
>>>        It is a long time since I did one and mine was a vertical
>>>        motion but from memory, here is an outline on how to go about it.
>>>
>>>        The program has two segments.  The first to generate a list of
>>>        numbers that runs only if you change swing parameters.
>>>        This list of numbers is used by the second program segment
>>>        that moves the swing.
>>>        For the first part that generates the data list:-
>>>        You decide how many steps you want to do from peak to peak on
>>>        the swing.
>>>        This can be user-setable if you want to adjust smoothness.
>>>        Divide 180 degrees by this number to get the step angle for
>>>        looking up.
>>>        Start at 90 degrees and step to -90 degrees (converted to
>>>        radians) and look up the llSin() of these angles and put them
>>>        in a list.
>>>        This will give you a list of numbers starting at +1 and ending
>>>        at -1.
>>>        You now step through this list to create a second list.
>>>        You need to scale and convert the numbers from +1 through -1
>>>        to an angle for llSetRot().
>>>        So +1 will correspond to the highest point on the swing, say
>>>        35 degrees (which can be user adjustable too).
>>>        zero will correspond to swing vertical
>>>        -1 corresponds to swing back 35 degrees, all converted to radians.
>>>
>>>        You run this segment as needed to create the working list that
>>>        contains the angles that are plugged into llSetRot() only on
>>>        rez, or when user wants to change one of the parameters.
>>>
>>>        To run the swing have it sit at half way through the list
>>>        (vertical) if you want it to be able to stop.
>>>        When it starts, step through the list using a timer set to
>>>        total swing time divided by the number of steps (can be user
>>>        adjustable).
>>>        You will be stepping from mid point on the list to the bottom,
>>>        then reverse and step through to the top, then reverse again.
>>>        On each step put the list angle value into llSetRot().
>>>
>>>        Although it is not physical, there is some smoothing built
>>>        into llSetRot() changes, they don't move instantaneoulsy so
>>>        experiment to find the minimum number of steps that looks
>>>        smooth and reduces computing overhead.
>>>
>>>        If you want to get REALLY fancy, you can let the swing
>>>        accelerate/decelerate on start/stop by changing the 35 degree
>>>        angle in increasing/decreasing steps from/to zero,
>>>        recalculating the angle list each time.
>>>
>>>        I'm sure the above could be written to calculate the angles on
>>>        the fly instead of using the list look-up but I did it this
>>>        way.  It is easier to understand and is probably less
>>>        processing load on the sim computer.
>>>
>>>        AnnMarie Otoole.
>>>
>>>
>>>        ----- Original Message ----- From: "G" <gcanaday@...
>>>        <mailto:gcanaday@...>>
>>>        To: <secondlifescripters@...
>>>        <mailto:secondlifescripters@...>>
>>>        Sent: Thursday, September 04, 2008 11:22 AM
>>>        Subject: Re: Repulsion between physical and other objects
>>>
>>>
>>>
>>>            Ann,
>>>
>>>            oo? How does that work? /me looks for example...
>>>
>>>            G
>>>
>>>
>>>
>>>
>>>    _______________________________________________
>>>    Click here to unsubscribe or manage your list subscription:
>>>
>>>  https://lists.secondlife.com/cgi-bin/mailman/listinfo/secondlifescripters
>
> _______________________________________________
> Click here to unsubscribe or manage your list subscription:
> https://lists.secondlife.com/cgi-bin/mailman/listinfo/secondlifescripters
>
_______________________________________________
Click here to unsubscribe or manage your list subscription:
https://lists.secondlife.com/cgi-bin/mailman/listinfo/secondlifescripters

 « Return to Thread: Repulsion between physical and other objects