Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llApplyImpulse gives differing results

Montecore Babcock
Registered User
Join date: 20 May 2006
Posts: 48
07-23-2008 19:17
I use an attached prim and the llApplyImpulse command in a script in the prim to move me. Now what is odd is that if I change graphics settings my speed will change. On SL's lowest graphic setting I will be very fast, and at the other settings not so fast. Also, other avis will move faster or slower too when they use that scripted command. I was told that the speed should be constant within SL, but obviously it's not.

Does anyone know why this is happening and if there is a way to insure a constant speed no matter what graphic setting or PC?

Thanks!
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
07-23-2008 19:23
How are you measuring speeds?
_____________________
Montecore Babcock
Registered User
Join date: 20 May 2006
Posts: 48
Speeds
07-23-2008 19:59
Timing myself across a distance traveled. Also, I can observe others that move faster than others as well.
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
07-23-2008 20:09
Ok, but timing using the wall clock and looking at the viewer, or are you stamping coordinates and times by script?

llApplyImpulse really is a server thing, for real, but if the impulses are trigged by user input then it could make a difference. Are there those or other kinds of interactions in your script?
_____________________
Montecore Babcock
Registered User
Join date: 20 May 2006
Posts: 48
Speeds
07-23-2008 21:02
I have a flat surface approximately 70 meters long. The impulse is applied when I use the forward arrow button (I take control of that key for avi movement). So I press and hold the forward button and start a stopwatch at the same time and when I get to the end I stop the stopwatch. On higher graphics settings the time may be 8 seconds, and on the lower settings as low as 5 seconds.

It's also quite noticeable when watching other avi's who are going faster than others.
Montecore Babcock
Registered User
Join date: 20 May 2006
Posts: 48
And another thing
07-23-2008 21:06
I've used an open source speedometer script in world to measure speeds and it has also reported higher speeds with lower graphics settings.
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
07-23-2008 23:03
The keyboard control is there, then.

One thing to look at is the differences in client responsiveness you get with different graphics settings. In the script, try grabbing start and end times for the keyboard edge events, and get a count of held triggers too. Control events trigger pretty rapidly by default, and if you are doing something like one impulse per event, there is a good chance that you are simply getting more impulses with the faster viewer setting. llMinEventDelay would help to even it out some across graphics settings, if this is what's hitting you.
_____________________
Urrong Urnst
Registered User
Join date: 12 Jul 2008
Posts: 49
07-23-2008 23:16
Well i havent tested that one out yet but if it is true it might be that lower graphic settings send the code of the pressed key more often than in higher graphics. So if im not mistaken i understod that u hold down the forward button so control event is triggered everytime u send information from your client(PC/Mac) to the server. SL like every other online thing uses interpolation for calculation movement and stuff. So when in lower graphics the client sends the info of the forward key pressed down more often cuz it doesnt need the net connection for other things. That is just my guess. I didnt look anything up in jira and it might be just client bug.

U said that other avis also move faster. Do only u see them moving faster or are they your friends and u said to them to lower graphics and try? If u didnt than it is client problem that u have. Maybe slow connection or not that good hardware.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
07-24-2008 00:54
I wouldn't say it's a bug in the client. If you really want to use llApplyImpulse() to try to keep yourself going a constant speed, calculate the impulse based on your current velocity and the desired one, rather than giving a constant impulse on each event. Something like:

CODE

llApplyImpulse(llGetMass()*(desiredVelocity-llGetVel()), FALSE);
Montecore Babcock
Registered User
Join date: 20 May 2006
Posts: 48
Trigger counts
07-24-2008 15:49
From: Viktoria Dovgal
The keyboard control is there, then.

One thing to look at is the differences in client responsiveness you get with different graphics settings. In the script, try grabbing start and end times for the keyboard edge events, and get a count of held triggers too. Control events trigger pretty rapidly by default, and if you are doing something like one impulse per event, there is a good chance that you are simply getting more impulses with the faster viewer setting. llMinEventDelay would help to even it out some across graphics settings, if this is what's hitting you.


Hi Viktoria

I put a counter in that says the begin count and end count when you start and release the forward key. and when the key is held, the counter increments by one.

Under SL's low graphics setting the count was 267 times, while under high it was 341 times. I took a few passes and the counts don't have a lot of variance. This tells me that because I'm taking longer and I'm slower it's recording more key counts and impulses, yet the added impulses are not increasing the speed.

Any other ideas?

Thanks.
Montecore Babcock
Registered User
Join date: 20 May 2006
Posts: 48
07-24-2008 16:19
From: Hewee Zetkin
I wouldn't say it's a bug in the client. If you really want to use llApplyImpulse() to try to keep yourself going a constant speed, calculate the impulse based on your current velocity and the desired one, rather than giving a constant impulse on each event. Something like:

CODE

llApplyImpulse(llGetMass()*(desiredVelocity-llGetVel()), FALSE);



Hewee,

Maybe I'm doing it wrong but I got very bad results with that. The avi either didn't move much or it shot through the sim.