Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Phys objects get flung away

Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
07-31-2009 14:17
I've been building a lot of little scripted robots lately, and there's something I noticed- any time I rez one of these items with the Physical check box enabled (they have to be physical for a lot of the scripts to work), the object takes off across the sim at blinding speeds, and will keep going until it hits a no entry parcel. In one particular case, I have a little object that follows avatars. When I place it, it goes flying across the room in an arc, like someone threw it, until the llSensorRepeat kicks in and it snaps to the nearest avatar.

However, if I rez the object without physical and let the script turn it physical after a pause, there's no problem.

Anyone experience anything like this?
_____________________
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-31-2009 16:20
not usually, unless it's intersecting another prim (or sometimes within the hollow of one)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
07-31-2009 16:30
Do you use llMoveToTarget in your script?

I think the target is a prim property, like color or floaty text. If you Take it while it wants to be going somewhere, it will remember that when you re-rez it..
_____________________
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
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
07-31-2009 18:59
From: Sindy Tsure
Do you use llMoveToTarget in your script?

I think the target is a prim property, like color or floaty text. If you Take it while it wants to be going somewhere, it will remember that when you re-rez it..



Even using llResetScript on rez?
_____________________
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
07-31-2009 19:08
From: Paul Wardark
Even using llResetScript on rez?

Dunno - I'd have to test that..

Are you using llMoveToTarget? If not, it's sorta moot..
_____________________
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
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
07-31-2009 22:16
From: Sindy Tsure
Dunno - I'd have to test that..

Are you using llMoveToTarget? If not, it's sorta moot..


On one of the objects, yes.
_____________________
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
08-01-2009 05:49
You could always put llStopMoveToTarget() in the default state_entry and see if that helps. Or I'll test it out later when more time presents itself..
_____________________
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
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
08-01-2009 15:10
Hm.. It seems that the target does indeed survive a cycle through inventory but not a script reset.. This is the script I tested with and the object starts flying away as soon as it's rezzed then goes tumbling as the reset hits.

CODE
default
{
state_entry()
{
llOwnerSay ("state_entry");
}

on_rez(integer param)
{
llOwnerSay ("on_rez");
llResetScript();
}

touch_start(integer count)
{
if (llDetectedKey(0) == llGetOwner())
{
llSetStatus (STATUS_PHYSICS, TRUE);
llMoveToTarget (llGetPos() + < 0.0, 0.0, 5.0 >, 2.0);
}
}
}
_____________________
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
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
08-01-2009 15:31
Then try putting llMoveToTarget(llGetPos()+ < 0,0,0.1>, 2.0); in your on_rez event, just before you llResetScript(). If it's still holding onto the old target, maybe setting a new dummy target will divert its attention and make it stay put when it rezzes.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
08-01-2009 16:19
That's work.. Or turning off physics and llStopMoveToTarget.

/me considers adding a JIRA saying that the target should not persist across a trip through inventory. Or can somebody think of a real use case where it's a good idea?
_____________________
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
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
08-01-2009 16:39
From: Sindy Tsure
That's work.. Or turning off physics and llStopMoveToTarget.

/me considers adding a JIRA saying that the target should not persist across a trip through inventory. Or can somebody think of a real use case where it's a good idea?

sort of... if the object is designed to occupy a certain position on the sim, regardless of what sim it's rezzed in (networked sensors for example)

perhaps a check before any move to target calls are made, with a variable set in the on_rez event?
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
08-01-2009 18:34
From: Void Singer
sort of... if the object is designed to occupy a certain position on the sim, regardless of what sim it's rezzed in (networked sensors for example)?

Hm.. Maybe.. Still seems to me like it probably causes more trouble than it's worth..
_____________________
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
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
08-02-2009 01:17
Well, it's annoying as hell, trying to rez something and watching it shoot off the sim.

You guys think I'll have to add a state to it to make it stop moving places on rez, before the rest of the Movement script kicks in?
_____________________
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
08-02-2009 01:21
what about just setting the current target in the on_rez to something like llGetPos?
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
08-02-2009 06:09
Or, as I suggested, deliberately moving it to a fresh target a short distance away during on_rez and then doing a llResetScript.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
08-02-2009 07:28
From: Paul Wardark
You guys think I'll have to add a state to it to make it stop moving places on rez, before the rest of the Movement script kicks in?

Dunno if it needs a new state but if you don't want it to go flying away, you either need to disable physics on it & llStopMoveToTarget or pick a new, valid target for it or have it move just a little from it's current location. I don't think you have any other options, except for letting it work as it does now...
_____________________
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