Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llMoveToTarget gravity effect?

Fillo Farber
Registered User
Join date: 6 Jun 2004
Posts: 60
09-20-2009 14:31
Hey all
Using llMoveToTarget to move in a upward and downward diagonal and I'm seeing odd results. When my object moves up, it goes directly to the target with no offset. When it moves down, it reaches the target z before x and y then continues in x or y as needed to complete the move - in other words like an L move. Is this something to do with mass, energy and gravity? How do I prevent this offset on the down diagonal move?

thanks again in advance for replies!
Fillo Farber
Registered User
Join date: 6 Jun 2004
Posts: 60
09-20-2009 15:21
Thought I would add this simple example that demonstrates the issue.


default
{
state_entry()
{
llMoveToTarget(<16,77,2>,1);
}
}

Just to show it isn't some complicated code where I may have an error, I ran the above and it exhibits the same problem.
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
09-20-2009 15:24
Yep.. http://jira.secondlife.com/browse/SVC-2441.

I believe LL said that they would not fix this because they thought it would break too much existing content.
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Fillo Farber
Registered User
Join date: 6 Jun 2004
Posts: 60
09-20-2009 15:31
From: Sindy Tsure
Yep.. http://jira.secondlife.com/browse/SVC-2441.

I believe LL said that they would not fix this because they thought it would break too much existing content.


Oh that's interesting Sidny. Thanks... Now I change my request :)

Does anyone know of a mathematical bandaid for this? I haven't yet determined what the relationship is between the error and the xyz distances to target. Maybe its as simple as adding a multiplier to the x & y such as 1.03 or something? (I dont care if it over shoots - as long as it hits the target in a straight line) If I find the solution I will post it as well.
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
09-20-2009 15:53
How to work around it depends on what you're trying to do. Moving faster will lessen the effect. If you can't do that, I think it's just trial & error to find the right way to adjust the target for your application.
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Indeterminate Schism
Registered User
Join date: 24 May 2008
Posts: 236
09-20-2009 16:40
This may relate to the 'simulating gravity' thread in this forum as well.
First I have to say I haven't done much scripting of physical objects because they tend to kill the sims and there's not much use for them.
However, gravity (in RL) at ground-level is approximately 9.8mss. I don't know what value SL uses, but it must be close to 'look' right.
So what we have to look for is a function that will counteract gravity in your example. This is purely speculative but does llSetForce() meet your needs? Apply a vertical force equal but opposite to SL's "gravity" and you could be ok. Again, I have absolutely no idea how this will actually interact with llMoveToTarget() but, hey, science is experimentation, right?
Fillo Farber
Registered User
Join date: 6 Jun 2004
Posts: 60
09-20-2009 20:14
OK I did some tests...

When the start position y is 1m less then target y I get these numbers. The delta x values are distance to target from start position. The error is the y offset value when the object reaches the targeted x value.

delta x y
value error
===========
45m .032m
40m .035m
20m .07m
10m .134m
9m .145m
8m .161m
7m .181m
6m .205m
5m .237m
4m .278m
3m .339m
2m .439m
1m .607m

As I said, the above table reflects when delta y is 1m. If you move y 2m the above errors double, 3m they triple etc.

I tried a sqrt function but it doesn't seem to fit. Does anyone see the pattern here?
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
09-20-2009 20:33
My memory's foggy here but I think Simon Linden said this was related to gravity. Like maybe the sim was applying it but on more frames than it should be? Er.. Something like that. I remember not liking the answer because I didn't think gravity should be applied to targeted moves.

Simon is usually at Andrews office hours. You could go and bug him about it. http://wiki.secondlife.com/wiki/Office_hours
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left