simple movement script
|
Kim Ludd
Registered User
Join date: 6 Jun 2005
Posts: 17
|
12-15-2005 09:59
This should be simple, but I am very new to scripting - a script that moves an object horizontally, then rotates 90 degrees on the y-axis, then moves up (picture a box being dragged by a rope and then lifted up - it isn't a vehicle, just needs to move on its own when told to). I'm willing to pay for a scripting tutor who can do this with me (or for me), and explain the script to me. please IM me or Katherine Mullen inWorld. forgive the cross posting, I wasn't sure where it would be best to post this request. /204/07/77575/1.html#post802204
|
Sydney Alexander
Registered User
Join date: 19 Feb 2005
Posts: 69
|
12-15-2005 11:08
Hi Kim - Try this thread: /54/71/57772/1.htmlWhat you are asking for is not hard to do and this script might be a good place to satrt. It talks about how to move a "prim" or "object" with voice or touch. My thought here would be that you could make both your moves with this script and some minor editing. I am at work so I can not play around with it. I am no expert and I am sure someone here will have a better answer, but I hope it helps. Happy Holidays Sydney
|
Kim Ludd
Registered User
Join date: 6 Jun 2005
Posts: 17
|
12-29-2005 13:59
The following works for the movement that i need: rotation ron; default { state_entry() { ron=llEuler2Rot(<0,PI/2,0>  ; } touch_start(integer total_number) { llSetPos(llGetLocalPos() + <-5, 0, 0>  ; llSetLocalRot(ron); llSay(0, "moved"  ; llSetPos(llGetLocalPos() + <0, 0, 5>  ; } } BUT... I need to slow it down. I'm not sure about the best way to do this. Any tips? Thanks!
|
Damien Took
Meat Popsicle
Join date: 3 Dec 2004
Posts: 151
|
12-29-2005 14:51
rotation ron;
default
{ state_entry() { ron=llEuler2Rot(<0,PI/2,0>); }
touch_start(integer total_number) { integer i; for( i = 0; i > -5; i--) { llSetPos(llGetLocalPos() + <i, 0, 0>); llSleep(0.5); } llSetLocalRot(ron); llSay(0, "moved"); for( i = 0; i < 5; i++) { llSetPos(llGetLocalPos() + <0, 0, i>); llSleep(0.5); } } } Increase the 0.5 to slow it down, decrease to a minimum of 0.2 to speed it up. Hope that helps.
|
Kim Ludd
Registered User
Join date: 6 Jun 2005
Posts: 17
|
12-29-2005 15:22
thank you. That gave me a better understanding of looping.
As you have it now, though, it repeats the movement (with pauses), rather than just slowing down the movement.
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
12-29-2005 15:46
A non-physical object always moves more-or-less instantaneously from point A to point B (assuming the distance between A and B is less than 10m). The only way to make it go 'slower' is to move it in smaller steps. To really make it move slowly, you'll have to turn physics on, and use llMoveToTarget to get true damped movement. And then you'll have to deal with some other issues - making sure your object doesn't fall to the ground the moment you turn physics on (look at buoyancy or hover height), making sure someone can't bump into the object and move it off-course (phantom might be a solution here), and so on.
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
12-29-2005 17:32
Although this is the trick I used in my elevator, what about this? integer slower = 10;
default
{ state_entry() { ron=llEuler2Rot(<0,PI/2,0>); }
touch_start(integer total_number) { integer i; for( i = 0; i < slower; i++) { llSetPos(llGetLocalPos() - <5 / slower, 0, 0>); } llSetLocalRot(ron); llSay(0, "moved"); for( i = 0; i < slower; i++) { llSetPos(llGetLocalPos() + <0, 0, 5 / slower>); } } }
_____________________
 Seagel Neville 
|
Damien Took
Meat Popsicle
Join date: 3 Dec 2004
Posts: 151
|
12-29-2005 23:10
Yes, this will just move the prim in small steps, not smooth. But like Ziggy said, if you make it physical you can use llMoveToTarget for a smooth move and adjust the speed.
|
Kim Ludd
Registered User
Join date: 6 Jun 2005
Posts: 17
|
12-30-2005 10:57
I tried the following and all it did was rotate (no horizontal or vertical movement): integer slower = 10; rotation ron; default { state_entry() { ron=llEuler2Rot(<0,PI/2,0>  ; } touch_start(integer total_number) { integer i; for( i = 0; i < slower; i++) { llSetPos(llGetLocalPos() - <5 / slower, 0, 0>  ; } llSetLocalRot(ron); for( i = 0; i < slower; i++) { llSetPos(llGetLocalPos() + <0, 0, 5 / slower>  ; } } } I have not had much luck with MoveToTarget .... but i will give that another try. Thanks all!
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
12-30-2005 21:30
Sorry, I thought it just in my mind and didn't test it. Replace "5.0/slower" for "5 / slower". It must have been float. And though I'm not sure but if you put space around "/", it wouldn't work... 
_____________________
 Seagel Neville 
|