Thursday, December 4, 2008

Physical Vehicles Update

**** Physical Vehicles Update ****

The short story is, we have a few now :D

Thanks to one Owen Oyen of SecondLife and OSGrid :)

One day last month, Owen showed up at my deltazone region to discuss physical vehicles. Owen makes some rather specialized content in SL - he is the one who brought us the pitching of boats under sail, tidal currents based on an analysis of sailing grounds, and a host of other good things related to virtual sailing in SL.

Owen's concern that day we met was why exactly there were no physical vehicle functions implemented yet in opensim. After a brief bit of discussion, we came to the conclusion that the llVehicle class of functions in LSL are really a dramatically simplified approximation of a linear motor with some twists thrown in - literally - for rotating a vehicle about it's axis of travel.

As proof of our sound thinking, Owen produced in collaboration with myself, a very satisfying and functional virtual sailboat :) recently, Owen and Bri Hasp have extended this further, producing an iceboat as well :D

Both are available at or near the south edge of Bri's 'Baya' sim on OSGrid. Unfortunately, Owen has chosen not to make the scripts open - leaving it to me to apply what I learned with him in the production of such scripts.

While I have not yet produced these scritps (I got a job shortly after Owen released his freebie-but-no-copy boat), I will do so in the future - and, I will happily share with you the basics of the implementation.

First, llSetForce and llApplyImpulse are used as motors, depending on the need and circumstance. Owen, I think, finally settled on the use of llSetForce exclusively, but for reasons that were a bit obscure to me. Second, to prevent the vehicle from accumulating energy on an exponential curve, llGetMass is used to calculate a bit of friction, which takes the form of a force applied in a direction opposite to the direction of motion, in the same timer-driven calculation that applies the force which keeps the boat moving.

Finally, a wind source and sail position/forces are calculated and applied. Coupled with some stabilization and correction of movement through the periodic re-inititalization of axes outside that along which movement occurs with constants (usually zero), we have a boat that is readily pushed about the sim on Owen's 'wizard wind', which he has scripted into the boat as well.

Maybe that reads like greek to you - if so, go pick up one of Owen's freebies at Baya and just go have fun with it. Be sure to read the included notecards, because this vehicle has peculiarities and quirks uniquely associated with opensim. If not, I heartily ecourage you to take up this ground-breaking work and see what sorts of vehicles you can produce.

Off to attempt to build Rexx viewer source on linux :D

Cheers for now :D

and see the following post, wherein I describe my rexx-viewer-on-linux-viewer-building experiences.


1 comment:

Anonymous said...

Nice summary of the work Hiro, and congrats on getting the job!