Jump to content

x-post | Having issues with making a simple loop of a ball falling down a hill...


pastela
 Share

Recommended Posts

(Realized I posted this in wrong section first >.<)

...

First let me say I am quite new to scripting here!

...

default{

        state_entry() {

                llSetTimerEvent(5); //takes about 5 seconds to roll down the hill with physics

        }

        timer() {

                llSetAlpha(0.0, ALL_SIDES); //don't want to see the ball go anti-gravity

                llMoveToTarget(<27,72,221>, 0.1); //top of hill

                llSetAlpha(1.0, ALL_SIDES); //and it is back!

                llSetStatus(STATUS_PHYSICS, TRUE);

        }

}

Why won't this work? It chooses to just float (and does a wacky spin) above the hill when it gets back up and does not loop.

Also, if you have a more efficient way of doing this please tell!

I was trying to set up an if statement for if it hits a certain x or z location (the hill is not nice and smooth so can not predict where is lands on the y axes / left or right at the base of the hill) then it goes back up to the target... but that didn't even work the first way through >.<

Thanks!

Anna Pastela
(pastela.Resident)

Link to comment
Share on other sites

The reason you're having difficulties, I think, is that you need to turn off llMoveToTarget once you arrive at your destination, if, that is, you're using llMoveToTarget.    Take a look at llTarget(), llTargetRemove() and the at_target event.  [ETA: and llStopMoveToTarget(), too.. thanks Qie].

However, there's a much easier way to do it.   In the timer, after you've turned the ball invisible, turn off physics and put it back on top of the hill with llSetRegionPos.   Then turn physics back on after you get there.

  • Like 1
Link to comment
Share on other sites

Thank you that really helps! :)
llSetRegionPos made everything peachy ^^
Here is my final script...

default{

state_entry() {
llSetStatus(STATUS_PHYSICS, TRUE);
llSetTimerEvent(7); //takes about 7 seconds to roll down the hill with physics
}
timer() {
float randomFloat = 75 - llFrand(10);
llSetStatus(STATUS_PHYSICS, FALSE);
llSetRegionPos(<25,randomFloat,121>); //top of hill
llSetColor(<llFrand(1.0),llFrand(1.0),llFrand(1.0)>, ALL_SIDES);//groovy
llSetStatus(STATUS_PHYSICS, TRUE);
}
}

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...