Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

totally confused on how to do this...

Micheal Moonlight
Registered User
Join date: 4 Sep 2005
Posts: 197
11-15-2005 20:44
I'm trying to just make a simple toboggan that when you sit down, it goes down a hill... no need to capture movements... nothing fancy, just follow the hills slope until the bottom then slow down like it would real life... but every attempt i've made of using the games physic's, motor controls etc has failed with either the sled not going down the hill just rotating in place... or zooming so fast everythings a blur almost, and mostly in the air until it gets stuck somewhere. If anyone could help me achieve this i would be very grateful...
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
11-15-2005 21:51
From: Micheal Moonlight
I'm trying to just make a simple toboggan that when you sit down, it goes down a hill... no need to capture movements... nothing fancy, just follow the hills slope until the bottom then slow down like it would real life... but every attempt i've made of using the games physic's, motor controls etc has failed with either the sled not going down the hill just rotating in place... or zooming so fast everythings a blur almost, and mostly in the air until it gets stuck somewhere. If anyone could help me achieve this i would be very grateful...


what you'll need to do is have it set up so that when someon sits on it, the toboggan becomes physical, and a push is given along the "forward" axis of the root prim. after that, the physics engine should kick in and it will ride down the slope. I've ridden 2 or 3 tobbogans in SL but can't recall where prescisely right now.
Logan Bauer
Inept Adept
Join date: 13 Jun 2004
Posts: 2,237
11-15-2005 22:32
Additionally, I think if you capture llGround(), wait a sec and then capture it as a different variable, then use llVecDist() to get the distance between the two, and then llLookAt() that vector, it will basically capture the angle of the ground as it moves and turn towards that angle. Could be wrong tho, might need to use something other than llLookAt...

Micheal, could you possibly post the vehicle script you're using here? If you have it set up using a car or ground vehicle script I think it should tilt level over the land automatically, actually, now that I think about it. Rotating and hitting something and flying a sim away are vehicle engine bugs,but if this is happening for you more than other vehicles you've tried post the script here and I'm sure someone can help ya.

Oh, in the meanwhile make sure you have these lines in your state_entry...

llSetStatus(STATUS_ROTATE_X,TRUE);
llSetStatus(STATUS_ROTATE_Y,TRUE);
llSetStatus(STATUS_ROTATE_Z,TRUE);

If you have any of these set to "false" in your vehicle script it will not rotate fully.
RacerX Gullwing
Magic Rabbit
Join date: 18 Jun 2004
Posts: 371
11-15-2005 22:34
I once had a lot of fun just made a sphere colored it white and sat on it then streched it some so just my head stuck out and added phisics. Bounced down the mountain, Especially fun in mouse view, If you get a few more folks to sit on it it makes it have a nice wobble, though this was a few updates back so not sure resizing a sphere when people are on is possible anymore.
I also made a tobaggon but never found a good sled type script to put in it so i threw a helocopter script in it and made it fly while you stand in a surfing position

but that sounds like a plan forget the vehical engine and just give it a push at the start hmm bet repel ground or set hoverhieght low might decrease the friction some too. Ok I'm on it look me up in a few I should have that script.
RacerX Gullwing
Magic Rabbit
Join date: 18 Jun 2004
Posts: 371
11-15-2005 23:06
hmm well only managed to make a tumbling sled with out the added protection of snow pack
me not gliding nicely down the hill
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
11-16-2005 09:05
From: Logan Bauer
llLookAt() that vector, it will basically capture the angle of the ground as it moves and turn towards that angle.


I had severe problems with llLookAt trying to view a calculated vector and had to resort to manually calculating a vector based on global coordinates (because of sim borders getting in the way), and then ussing the lllRotBetween command to calculate the rotation that my prim would need to rotate on to look along the correct vector; basically building my own llLookAt from scratch. here's my code to look at a fixed point (need to call this in a timer loop to have it update constantly)

CODE

PointToTarget() { //This is what controls the pointer to point towards the next waypoint. since waypoints might cross sim boundaries (ie, a cross country road race), I elected to use global coordinates
if (llGetAttached() == 0) { llSetRot(ZERO_ROTATION); }
else {
vector gpos = llGetRegionCorner() + llGetPos(); //global position of the person if it's an attachment, global position of a prim if it's not attached
vector target = <x,y,z>; //global position of the place it's looking at in global coordinates. for your use you may want to calculate this "on the fly" so to speak, probably calculated a step ahead of calling PointToTarget in your timer loop. you might have a phatom prim with an alpha value of zero set linked to your toboggan 1m ahead of the actual toboggan and put in a script where it calls out the ground's position and then the toboggan listens for that call to fill in this value. since the gpos is in global coordinates you'd have to do a (llGetRegionCorner()+groundvalueofphantomprim) to calculate this properly
rotation rot = llRotBetween(<0,0,1>,llVecNorm(target-gpos)); //Converts the vector used to point at the waypoint into a rotation
llSetRot(rot/llGetRot()); //rotates the pointer to where it needs to look at. the current form works if it's an attachment. if it's not an attachment, just use llSetRot(rot);
}


[edit] I think I missed a bracket or ; in there somewhere so it might no be a simple CnP if you want to use it [/edit]
Bostek Nostram
Registered User
Join date: 4 Oct 2008
Posts: 8
10-04-2008 07:39
I would like to know if it is possible to buy toboggan script? because i would need it and i dont have time to make it. thanks