Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Object movement

Ikonn Giano
Registered User
Join date: 15 Dec 2007
Posts: 126
04-02-2008 13:21
Hello all I’m working on a trolley I get it to move and follow the track but I’m having some trouble with the speed I can't seem to figure out what command is for how fast or slow it moves can anyone help me with this?

Also looking for some idea or script on how to open doors say when the trolley gets to its location ... thinking I need some kind of door sensor?

Thanks for your help!!
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
04-02-2008 16:24
Would be easier to help you if you posted your script. There are several different ways toget an object to move from one point to another, and how you control your speed depends on which method you're using. Are you using physical or non-physical movement? If it's physical, is that with pushing, setting a force, or moving to a target? There may be other options I'm forgetting.
Ikonn Giano
Registered User
Join date: 15 Dec 2007
Posts: 126
04-04-2008 14:40
yes i am using physical. Here is that section i have

llMoveToTarget(waypoint, tau);
llLookAt(waypoint,1,1);
llRotLookAt(set_rot,1,1);
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
04-04-2008 14:57
Have you tried playing with the strength and damping fields? The Wiki contains some suggested values.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
04-04-2008 15:23
The movement caused by llMoveToTarget() (in the absence of other forces and interactions) is exponentially decaying. That means the closer you get to your target, the slower the object will move. In fact, the CURRENT speed should be roughly equal to the current distance from the target divided by the damping period (tau). Another way to think of it is that the object should cover approximately 2/3 of the distance to the target (actually 1-1/e) in a period equal to the damping constant (so an AVERAGE speed for the first 2/3 of the journey of about 2/3*totalDistance/tau).
Dylan Rickenbacker
Animator
Join date: 11 Oct 2006
Posts: 365
04-04-2008 15:34
Try factoring in the distance between your current position and the next waypoint when you calculate your tau, like this for example:

CODE

not_at_target()
{
distance = llVecDist(llGetPos(),nexttarget);
llMoveToTarget(nexttarget,distance*0.75);
llLookAt(nexttarget,llGetMass()/2,llGetMass()/20);
}


The not_at_target event loops, so your tau will be constantly recalculated. This makes for a constant speed which you can control with the factor with which you multiply distance.
Ikonn Giano
Registered User
Join date: 15 Dec 2007
Posts: 126
04-04-2008 15:47
Thanks for the help... but I think this getting to be more then I know about scripting I was originally looking for a way to get it to follow a track like a tram or trolley and then stop at different locations and from the looks of this I’m not going to be able to make it run slow enough. you had mentioned playing with the damping fields but I’m not sure I know what that is.... is that the Tau? does anyone have a better idea or way to do what I was originally trying to do?


Thanks!!
Dylan Rickenbacker
Animator
Join date: 11 Oct 2006
Posts: 365
04-05-2008 01:05
Ikonn, you're on the right track. And it's not so much more difficult than you thought. Yes, the tau is the damping value. By giving this variable a value that is dependent on your distance from the target, you can control the speed.