August 16, 2022

Rotating Bike Wheels

Ok, this was probably very simple for experienced Second Life scripters, but for me I haven’t scripted in SL in years, and even then wasn’t that great. The fact that I cobbled this together is a small miracle, and thought I would pass this on.

Wikiwoo saw a gacha bike in a shop that we sell occasionally, but this one had spinning wheeks. She really wanted it, and I had to figure out how it was done.

The gacha was “{what next} Wearable Spring Garden Bike (wear me).” It was not the “…(decor)” version – I’ll get to that in a minute.

So I started tinkering with one of the same bikes we owned. I lucked out. The wheels were separate linked objects and each wheel’s local axis was straight through the axle. I had another similar bike in my inventory by the same creator, and the axis didn’t align with the wheel. I probably could’ve gotten it to work, but I’d need a few semesters of math first.

I also lucked out in that the permissions allowed me to add scripts. I was able to edit-linked one wheel at a time, create a new script, and paste this in. As soon as I stopped editing, the script ran and the wheel started turning.

The script:

default
{
    state_entry()
    {
       llTargetOmega(<10.0,0.0,0.0>*llGetRot(),0.1,0.01);
    }
}

Leave a Reply

Your email address will not be published.