Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Detect prim movement

InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
12-13-2009 19:40
I know this is easy if I use the get position and get rotation and use a timer that every time the timer goes off I check the current rotation and position with the old one then do something if it has been moved by editing the prim and moving it or rotating it.

But before I do this, is there a less laggy thing to use besides a timer? Is there some kind of event I don't know about hiding out there? And can osmeone point me to it in the wiki, or just tell me I am waiting time looking for it.
_____________________
__________________________________
InuYasha Meiji sama
犬夜叉 明治さま

Owner of InuYasha's Experimental Builds, IEB, selling Asian Furnishings and Historical items. Come see the tourist attraction, Shuri Castle Seiden, in Butler sim. Nightly Fireworks, ridable horses, trails into woods, animals to see, 7 seas fishing, and dancing in the throne room to jpop and anime music.
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
12-13-2009 21:26
The moving_end event might be what you're looking for.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-13-2009 23:09
moving end can be kinda flaky, unfortunately. you can work around it by only doing position tests in the moving event, then freezing the prim in place if it's under a certain threshold.
_____________________
|
| . "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...
| -
InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
Thanks, I will check it out.
12-14-2009 04:26
I wil have to give it a try today. Another message I found in the subject, but was wrotten back in July said thjat the fuction was broken and a JIRA was made. And at the time people where voting on it. Not sure, at the time of my reply, if anything has been done untill I go looking for it.

Thanks again.. I will see how it goes.
_____________________
__________________________________
InuYasha Meiji sama
犬夜叉 明治さま

Owner of InuYasha's Experimental Builds, IEB, selling Asian Furnishings and Historical items. Come see the tourist attraction, Shuri Castle Seiden, in Butler sim. Nightly Fireworks, ridable horses, trails into woods, animals to see, 7 seas fishing, and dancing in the throne room to jpop and anime music.
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
12-14-2009 04:38
Likely as not it hasn't been fixed, and that's probably what Void was referring to as "flakey". With any luck you should be able to find a way to get results using her workaround and experimenting with the moving* events.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-14-2009 12:32
the problem is that the physics engine has a tendency to continue to bounce physical objects around by very tiny increments, rarely letting it come to rest. ergo the moving_end event doesn't trigger predictably for physical objects.

it non-physical things it seems to be ok on.
_____________________
|
| . "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...
| -
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
12-14-2009 12:46
What kinda timer are we talking about? Once a minute or once every 0.01 seconds?

If it's no more often than every couple seconds or so I wouldn't worry too much about it. Using llVecDist is probably pretty fast. Maybe also ignore changes of less than 0.1m (or so) to avoid false positives/noise.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- 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
InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
Actually non physicle.
12-16-2009 04:57
From: Meade Paravane
What kinda timer are we talking about? Once a minute or once every 0.01 seconds?

If it's no more often than every couple seconds or so I wouldn't worry too much about it. Using llVecDist is probably pretty fast. Maybe also ignore changes of less than 0.1m (or so) to avoid false positives/noise.



Actually, I am working on doors for a building, using mathmatics to be sure they open and close properly no matter which direction the building is turned. Without needed the owner to make script adjustments. I want to tell the doors to be closed if the attached doors are turned to the same degree as the floor. This way a door that is closed when the floor is at 0 rotation, and the door is 0 rotation. then the floor turned at 45 degrees will know it has been moved. and will send the info via internal communications that the door must also start at 45 degrees to be closed and add 120 degrees to open from the 45 and not 0.

the house or building will only be moved when the owner positions the house or moves it in either location, or rotation.

since the house won't be physicle, I shouldn't have issues with faulse movement detection.
_____________________
__________________________________
InuYasha Meiji sama
犬夜叉 明治さま

Owner of InuYasha's Experimental Builds, IEB, selling Asian Furnishings and Historical items. Come see the tourist attraction, Shuri Castle Seiden, in Butler sim. Nightly Fireworks, ridable horses, trails into woods, animals to see, 7 seas fishing, and dancing in the throne room to jpop and anime music.
Indeterminate Schism
Registered User
Join date: 24 May 2008
Posts: 236
12-16-2009 07:39
For doors, especially if they're linked, you can llGetRootRotation() when you want to actually change the open/closed state, rather than updating it whenever the floor moves. Since they're linked the door will move with the floor and you only need to make sure you rotate to the correct angle
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-16-2009 10:08
well heck, you don't need to detect movement to do that, only how the door is rotated at that second....

_____________________
|
| . "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...
| -
InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
Feeling dumb, but I am so glad.
12-16-2009 14:06
From: Indeterminate Schism
For doors, especially if they're linked, you can llGetRootRotation() when you want to actually change the open/closed state, rather than updating it whenever the floor moves. Since they're linked the door will move with the floor and you only need to make sure you rotate to the correct angle


Even if I feel really dumb rightg now for not remebering that command exisited, I am glad I found out and happy you reminded me. Now the only things I will worry about it getting the info from the notecard to the doors to tell the doors connected to the floor who gets to lock and unlock all the doors. Thanks again, I really apprecate that bit of info.
_____________________
__________________________________
InuYasha Meiji sama
犬夜叉 明治さま

Owner of InuYasha's Experimental Builds, IEB, selling Asian Furnishings and Historical items. Come see the tourist attraction, Shuri Castle Seiden, in Butler sim. Nightly Fireworks, ridable horses, trails into woods, animals to see, 7 seas fishing, and dancing in the throne room to jpop and anime music.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-16-2009 15:51
forget root rotation, local rotation of the door prims is really all you need, works at any angle, even after being changed in between calls, the change in open or close behavior is applied based on the current local rot, and the open/close state is tracked by reversing that rot.
_____________________
|
| . "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...
| -
Indeterminate Schism
Registered User
Join date: 24 May 2008
Posts: 236
12-16-2009 20:43
Pffft! Where's the fun in that? lol
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
12-16-2009 23:53
From: InuYasha Meiji
Even if I feel really dumb rightg now for not remebering that command exisited, I am glad I found out and happy you reminded me. Now the only things I will worry about it getting the info from the notecard to the doors to tell the doors connected to the floor who gets to lock and unlock all the doors. Thanks again, I really apprecate that bit of info.
Sometimes I find it easiest to do that by keeping my access list(s) in a single main script in the root prim. Someone touches a door, the door sends a link message with the name to the access control script, and that script checks the name and either tells the door to open or IMs the av to say sorry, but you're not on the access list.
Indeterminate Schism
Registered User
Join date: 24 May 2008
Posts: 236
12-17-2009 01:20
From: InuYasha Meiji
Even if I feel really dumb rightg now ...


Don't. Otherwise the rest of us will have to as well, it's what this forum is for :-)
The thread does illustrate an important point though:
"When you ask a question, tell us what you're trying to achieve, not just what you're hung-up on. That way we can help with what you want to do, not just how you want to do it"

I think what you were trying to do 'felt wrong' to you anyway, which is why you asked in the first place. Nothing dumb about that :-)
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
12-17-2009 03:05
I like to use llTarget/not_at_target and llRotTarget/not_at_rot_target for this

From: someone
integer hPosTarget;
integer hRotTarget;

resetTargets()
{
llTargetRemove(hPosTarget);
hPosTarget = llTarget(llGetPos(), 0.001);
llTargetRemove(hRotTarget);
hRotTarget = llRotTarget(llGetRot(), 0.001);
}

changed_pos()
{
llOwnerSay("changed_pos";);
}

changed_rot()
{
llOwnerSay("changed_rot";);
}

default
{
state_entry()
{
resetTargets();
}

not_at_target()
{
changed_pos();
resetTargets();
}

not_at_rot_target()
{
changed_rot();
resetTargets();
}
}
_____________________
InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
Sorry so late Answering. And thanks all.
12-18-2009 10:55
From: Day Oh
I like to use llTarget/not_at_target and llRotTarget/not_at_rot_target for this


Sorry I didn't thank you all earlier. Two more holidays, in the way, and I can get back to work. I think part of the reason I didn't ask the whole question before, I was looking for an answer that might help me better understand how to do it. Not have someone do it for me. I have seen people complain in the past, about others, who ask for a free script, other then learn to do it themselves.

Besides I do want to learn, not just grab something I don't understand and use it.

Thanks again for all the help tho.
_____________________
__________________________________
InuYasha Meiji sama
犬夜叉 明治さま

Owner of InuYasha's Experimental Builds, IEB, selling Asian Furnishings and Historical items. Come see the tourist attraction, Shuri Castle Seiden, in Butler sim. Nightly Fireworks, ridable horses, trails into woods, animals to see, 7 seas fishing, and dancing in the throne room to jpop and anime music.