Object that slides downhill
|
Buster Peel
Spat the dummy.
Join date: 7 Feb 2005
Posts: 1,242
|
03-26-2005 10:56
I'm trying to make a bobsled object that slides down a hill with almost no friction, but trial-and-error is very frustrating. I have exprimented with the vehicle paramaters and cannot seem to get what I want. I've tried giving it a push, it just seems like there is too much friction no matter what settings I use (unless the hill is EXTREMELY steep.) I am trying to make something that will slide down even a gentle slope. Also, is there a way to make the vertical attractor work in relative to the grade of the ground instead of absolute rotations? Any hints greatly appreciated! Buster default {
state_entry() { llSitTarget(<0, 0.03, 1>, ZERO_ROTATION); llSetCameraEyeOffset(<-5.0, 0.00, 2.0>); llSetCameraAtOffset(<3.0, 0.0, 2.0>); llSetVehicleType(VEHICLE_TYPE_SLED); }
changed(integer change) { if (change & CHANGED_LINK) { key agent = llAvatarOnSitTarget(); if( agent) { if (agent != llGetOwner()) { llUnSit(agent); } else { llSetStatus(STATUS_PHYSICS, TRUE); } } else { llSetStatus(STATUS_PHYSICS, FALSE); } } } }
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-26-2005 15:25
There are several things you can do, ranging from tampering with llSetForce to creating an absolute movement and rotation using llGroundSlope, llLookAt, and if necessary, llMoveToTarget.For example, to get a system of rotation going, try: llLookAt(llGetPos() + llGroundSlope(ZERO_VECTOR),0.3,0.3);
_____________________
---
|
Buster Peel
Spat the dummy.
Join date: 7 Feb 2005
Posts: 1,242
|
03-26-2005 15:38
Any idea how I can get it to slide?
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-26-2005 16:17
Here's something to get you started, untested: vector slope = llGroundSlope(ZERO_VECTOR); // Our Slope vector position = <0,0,0>: // So we don't need to redeclare it each time float SPEED_CONSTANT = 20; // Our Speed Modifier float HOVER_HEIGHT = 0.5; // Height above the ground you want object to be
while(slope.z > 0.1) { llLookAt(llGetPos() + llGroundSlope(ZERO_VECTOR),0.1,0.1); llSleep(0.12); slope = llGroundSlope(ZERO_VECTOR); position = llGetPos() + (SPEED_CONSTANT * slope.z * llGroundSlope(ZERO_VECTOR)); position.z = llGround(position - llGetPos()) + HOVER_HEIGHT; llMoveToTarget(position,0.3); }
_____________________
---
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-26-2005 17:34
After some quick testing, here's a revision of the (simple) code that still runs a little fast: default { state_entry() { }
touch_start(integer total_number) { vector slope = llGroundSlope(ZERO_VECTOR); // Our Slope vector position = <0,0,0>; // So we don't need to redeclare it each time float SPEED_CONSTANT = 200; // Our Speed Modifier float HOVER_HEIGHT = 0.7; // Height above the ground you want object to be while(llAbs((integer)(slope.z * 100)) > 0.1) { llLookAt(llGetPos() + llGroundSlope(ZERO_VECTOR),0.1,0.1); llSleep(0.12); slope = llGroundSlope(ZERO_VECTOR); position = llGetPos() + (SPEED_CONSTANT * slope.z * llGroundSlope(ZERO_VECTOR)); position.z = llGround(position - llGetPos()) + HOVER_HEIGHT; llMoveToTarget(position,0.3); } } }
_____________________
---
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
03-26-2005 17:55
This may well have no relevance at all, but what material is the object made of? If memory serves I read that glass has the least friction.
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|
Buster Peel
Spat the dummy.
Join date: 7 Feb 2005
Posts: 1,242
|
03-26-2005 20:05
From: SuezanneC Baskerville This may well have no relevance at all, but what material is the object made of? If memory serves I read that glass has the least friction. I did switch to glass and that didn't make a difference
|
Buster Peel
Spat the dummy.
Join date: 7 Feb 2005
Posts: 1,242
|
03-26-2005 20:09
From: Jeffrey Gomez After some quick testing, here's a revision of the (simple) code that still runs a little fast: default { state_entry() { }
touch_start(integer total_number) { vector slope = llGroundSlope(ZERO_VECTOR); // Our Slope vector position = <0,0,0>; // So we don't need to redeclare it each time float SPEED_CONSTANT = 200; // Our Speed Modifier float HOVER_HEIGHT = 0.7; // Height above the ground you want object to be while(llAbs((integer)(slope.z * 100)) > 0.1) { llLookAt(llGetPos() + llGroundSlope(ZERO_VECTOR),0.1,0.1); llSleep(0.12); slope = llGroundSlope(ZERO_VECTOR); position = llGetPos() + (SPEED_CONSTANT * slope.z * llGroundSlope(ZERO_VECTOR)); position.z = llGround(position - llGetPos()) + HOVER_HEIGHT; llMoveToTarget(position,0.3); } } } Hmmm -- that's sort of cheating. I was hoping to come up with a way for a physical object to slide. I've been having fun rolling balls down my hill, but I really want to make a sled that slides down. I didn't try this script yet, but I will shortly. THANKS a million for you help!
|
Buster Peel
Spat the dummy.
Join date: 7 Feb 2005
Posts: 1,242
|
03-26-2005 20:41
From: Jeffrey Gomez After some quick testing, here's a revision of the (simple) code that still runs a little fast:
Jeffrey, I tried it and it did orient the thing exactly right, but it doesn't move. After I got out of world I looked at the script a bit more carefully, and I suspect it has to be physical? I will try that next time. Its always a good day when I learn something new! Buster
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-26-2005 21:26
Yep! I was too lazy to add llSetStatus(STATUS_PHYSICS,TRUE); 
_____________________
---
|