Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

a bit complex!!!

Boris Eebus
Registered User
Join date: 8 Feb 2008
Posts: 45
05-08-2008 16:51
ok I have a prim (prin A) and every time it moves I want it to update its position (xyz) in a label above it as it moves.

Also I want another prim (prim B) to rotate so it is always facing prim A

Where do I start???

All suggestions welcome

Thank you
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
05-08-2008 19:26
From: Boris Eebus
ok I have a prim (prin A) and every time it moves I want it to update its position (xyz) in a label above it as it moves.


for that you would use a timer and llGetPos() have the timer update the pos after X amount of seconds

kinda like this

MAY NOT BE THE RIGHT THING im alittle tired

CODE

update()
{
llSetText(llGetPos(),<1,1,1>,1);
}
default
{
state_entry()
{
llSetTimerEvent(.1);
}
timer()
{
update();
}
}


something like that
Keira Wells
Blender Sculptor
Join date: 16 Mar 2008
Posts: 2,371
05-08-2008 19:27
I'd start with a timer every X amount of seconds that checks the location (llGetPos), and then changes the llSetText value to reflect the most recent value. I don't believe there is a way to detect moving.. but I'm not certain.

From there, you could have it communicate it's location to the second prim and use llRotLookAt() to make it face the first.

This technically wouldn't be real-time updates, but if you didn't mind the lag from a faster timer it could be pretty accurate, but I'd be careful.

Also, if there is a way to detect movement without a timer or check every X seconds, that would help a lot, I just don't know of one personally.
_____________________
Tutorials for Sculpties using Blender!
Http://www.youtube.com/user/BlenderSL
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
05-08-2008 21:17
Well, you should be able to start the timer from a 'moving_start' event handler and stop it from a 'moving_end' handler. You shouldn't need to check periodically outside the context of those events (except maybe for 'on_rez' and such).

Also consider use of llGetObjectDetails() to get the position of an object you want to face point towards.
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
05-08-2008 22:14
From: Hewee Zetkin
Well, you should be able to start the timer from a 'moving_start' event handler and stop it from a 'moving_end' handler. You shouldn't need to check periodically outside the context of those events (except maybe for 'on_rez' and such).

Also consider use of llGetObjectDetails() to get the position of an object you want to face point towards.


Sadly, moving_start and moving_end are no longer considered reliable. Storing the "last known" position and then periodically checking if the current position has changed from the last time.. is pretty much the only "reliable" way to know if a prim has moved.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Barrington John
Yorkshire guy
Join date: 17 Nov 2007
Posts: 119
05-09-2008 10:40
From: Winter Ventura
Sadly, moving_start and moving_end are no longer considered reliable.

Ah - that's interesting - thanks. I'd encountered this in a door script and wondered why the hell the events weren't getting triggered most of the time. Duly noted.