Change font size
It is currently Tue Sep 18, 2018 8:07 pm

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 5 posts ]
Author Message
 Post subject: Getting Smooth Motion, bogging down the SIM
PostPosted: Fri Apr 13, 2012 1:54 am 

Joined: Fri Apr 13, 2012 1:19 am
Posts: 26
I tried and could not get the physics engine to move smoothly. On SL I have used llMoveToTarget, but it never was designed for linear motion, it always decays. (There is that trick everyone uses in SL of telling it to move twice as far as you want, then stopping it and re-starting it half way.) I experimented with it in OpenSim and it behaves very strangely. Not even moving in straight lines on long moves, and running away from me on short moves. Does anyone have experience with llMoveToTarget that will help?

llKeyframedMotion is not implemented on OpenSim yet. So what is a scripter to do?

I tried running my movements more often by giving llSetTimerEvent small time steps. But I discovered that no matter what value I give it, it never triggers timer() more often than once every 0.5 seconds. What is with this? llGetRegionFPS() says that my server FPS is 53, which should allow a timer of 0.01 seconds. Is 0.5 some configuration setting?

So in desperation, I llSetTimerEvent(0.5) and then moved my build 5 times every timer event with a llSleep(0.1) after every move (except the last one). This is not ideal, but the best I have found so far. Below is a sample script that does this. Now imagine 200 lines of code instead of that dumb circle calculation. Then imagine inside the for loop I also interpolate the rotation of the build so that it always faces the direction it is moving. I have some nice swimming and flying critters that use this and avoid or chase avatars, stay inside the parcel they are over, avoid running into the ground, stay above or below the water, etc.

Everything works great for a while, then I discovered that when too many of these things are running they all start to move in spits and starts. It turns out that when I ask for a timer of 0.5 seconds, sometimes I get 1.0 or even 2.0 seconds. Meanwhile llGetRegionTimeDilation() is always returning 1.0. Ignoring that, I'm still apparently exceeding some sim resource limit. But What can I do? Must I abandon building things that need a script to move then around?

{L_CODE}:
//sort of smooth motion test. Put in a small sphere above the ground
// (to give it room to move without running into the terrain)
vector origin;
vector radius=<2,0,0>;

default
{
    state_entry()
    {
        origin=llGetPos();
        llSetTimerEvent(0.5);
        llGetAndResetTime();
    }
    timer()
    {
        llSetText(llGetSubString((string)llGetAndResetTime(),0,3),<0,1,0>,1);
        vector old=radius;
            //Believe it or don't, the following two lines implements “circular” motion
            //Try to guess why!
        radius.x = radius.x + radius.y/8.0;
        radius.y = radius.y - radius.x/8.0;
        integer i;
        vector del=(radius-old)/5.0;
        for (i=1;i<=5;i++)   //break each timer call up into 5 micro-steps
        {
            llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POSITION,origin+old+del*i]);
            if (i<5)         //don't sleep on the last one, the timer will come back then
                llSleep(0.1);
        }
    }
}


Top
 Profile  
 
 Post subject: Re: Getting Smooth Motion, bogging down the SIM
PostPosted: Sun Sep 23, 2012 9:21 am 
Furious Typer
User avatar

Joined: Mon Aug 10, 2009 11:53 pm
Posts: 258
I realize this is way old, but are you *just* wanting circular movement of any kind?

If so what about llTargetOmega? I use it for all sorts of fun. Since it is a client side event it is usually smooth as butter movement for anything in a circular path.

I've got plenty of examples or would be happy to help if you still need any. :)

_________________
Sorry, I was just thinking upon the immortal words of Socrates who said ... "I drank what?? ... "
- Real Genius


Top
 Profile  
 
 Post subject: Re: Getting Smooth Motion, bogging down the SIM
PostPosted: Thu Sep 27, 2012 3:21 pm 

Joined: Fri Apr 13, 2012 1:19 am
Posts: 26
No, I don't want circular motion, but if I stuck 200 lines of swimming fish code in there, avoiding objects, staying in the water, turning away from the sim edges, turning towards avatars, etc. etc. etc, all that would detract from the central problem of the lack of a way to move things smoothly (in patterns more complex than a circle) in Open Simulator.
Since I wrote that, the 0.7.4 release came out and llMoveToTarget is more reliable and perhaps usable. Unfortunately it decays when I wanted linear motion, AND it decays 9 times faster than the same function on SL. I submitted a bug report about that, but it didn't make it into 0.7.4.


Top
 Profile  
 
 Post subject: Re: Getting Smooth Motion, bogging down the SIM
PostPosted: Mon Nov 12, 2012 5:19 pm 
User avatar

Joined: Mon Oct 12, 2009 11:37 am
Posts: 1
I don't know how much up to date this information is, but maybe it will provide useful on the topic:

http://opensim-dev.2196679.n2.nabble.com/TimerEvent-to-slow-do-while-faster-td7578144.html

It seems the [XEngine] section of the opensim.ini file can take a setting called "MinTimerInterval". Side effects and problems may come along with this though.


Top
 Profile  
 
 Post subject: Re: Getting Smooth Motion, bogging down the SIM
PostPosted: Mon Nov 12, 2012 8:32 pm 
Furious Typer

Joined: Sun Nov 22, 2009 5:28 pm
Posts: 68
I can say that you can get smooth running physics verhicles very easy. it worked already smooth 1 year ago. only some other things gave me headaces. now am rebuilding things again, on different operating system btw. and am very happy.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 5 posts ]


Who is online

Users browsing this forum: legacy_google [bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net