Page 1 of 2
Poseballs in sync?
Posted: Wed Apr 19, 2023 7:53 am
by Koshari Mahana
.
I'm trying to make a dance ring (balls going around in a circle) and I have everything made, it rotates fine and the poseballs have their animations in them but how do I make the dancers in sync? It seems like I had something like that working in SL many years ago but I just can't remember how to do it now. Thanks for any help.
.
Re: Pose ball in sync?
Posted: Wed Apr 19, 2023 8:24 am
by Ilan Tochner
Hi Koshari,
For the spinning of the ball please make sure to make it Phantom and use object properties and not a script that constantly updates the object's rotation. See:
https://wiki.secondlife.com/wiki/LlTargetOmega
Re: Pose ball in sync?
Posted: Wed Apr 19, 2023 9:29 am
by Koshari Mahana
Thanks, Ilan. It's been phantom, I make nearly everything phantom whether it moves or not (unless it's a wall or a floor). The simple rotation script is in the root prim so there shouldn't be a problem since it's phantom.
I don't know what you mean by "... use object properties and not a script..."
Re: Poseballs in sync?
Posted: Wed Apr 19, 2023 9:42 am
by Ilan Tochner
Use the function I linked to that sets the object's property once instead of using a script that changes the object's rotation once every X time.
Re: Poseballs in sync?
Posted: Wed Apr 19, 2023 10:43 am
by Graham Mills
Via phind.com (no time to check it). Re-query to see linked resources.
write a script in lsl for opensim that triggers an animation in two linked poseballs and then synchronises them
Code: Select all
// Define the animation name
string ANIM_NAME = "my_animation";
// Define the channel number for the animation
integer ANIM_CHANNEL = 1;
// Define the time it takes for the animation to play
float ANIM_TIME = 2.0;
// Define the linked poseball numbers
integer POSEBALL_1 = 1;
integer POSEBALL_2 = 2;
// Define the synchronization delay
float SYNC_DELAY = 0.5;
// Declare the functions that will play and synchronize the animation
play_animation() {
llMessageLinked(LINK_SET, ANIM_CHANNEL, ANIM_NAME, "");
}
synchronize_animation() {
llSleep(SYNC_DELAY);
llMessageLinked(LINK_SET, ANIM_CHANNEL, "sync", "");
}
// Declare the touch event function that will trigger the animation
default
{
touch_start(integer total_number)
{
// Play the animation on the first poseball
llSetLinkPrimitiveParamsFast(POSEBALL_1, [PRIM_ANIM, ANIM_NAME, ANIM_CHANNEL, ANIM_TIME, 0.0]);
// Play the animation on the second poseball
llSetLinkPrimitiveParamsFast(POSEBALL_2, [PRIM_ANIM, ANIM_NAME, ANIM_CHANNEL, ANIM_TIME, 0.0]);
// Send a message to synchronize the animation
synchronize_animation();
}
}
Update: I can see a few problems with the above.
Re: Poseballs in sync?
Posted: Wed Apr 19, 2023 7:05 pm
by Koshari Mahana
.
Thanks, Grahm! I'll give it a try.
.
Graham Mills wrote: ↑Wed Apr 19, 2023 10:43 am
Via phind.com (no time to check it). Re-query to see linked resources.
write a script in lsl for opensim that triggers an animation in two linked poseballs and then synchronises them
Code: Select all
// Define the animation name
string ANIM_NAME = "my_animation";
// Define the channel number for the animation
integer ANIM_CHANNEL = 1;
// Define the time it takes for the animation to play
float ANIM_TIME = 2.0;
// Define the linked poseball numbers
integer POSEBALL_1 = 1;
integer POSEBALL_2 = 2;
// Define the synchronization delay
float SYNC_DELAY = 0.5;
// Declare the functions that will play and synchronize the animation
play_animation() {
llMessageLinked(LINK_SET, ANIM_CHANNEL, ANIM_NAME, "");
}
synchronize_animation() {
llSleep(SYNC_DELAY);
llMessageLinked(LINK_SET, ANIM_CHANNEL, "sync", "");
}
// Declare the touch event function that will trigger the animation
default
{
touch_start(integer total_number)
{
// Play the animation on the first poseball
llSetLinkPrimitiveParamsFast(POSEBALL_1, [PRIM_ANIM, ANIM_NAME, ANIM_CHANNEL, ANIM_TIME, 0.0]);
// Play the animation on the second poseball
llSetLinkPrimitiveParamsFast(POSEBALL_2, [PRIM_ANIM, ANIM_NAME, ANIM_CHANNEL, ANIM_TIME, 0.0]);
// Send a message to synchronize the animation
synchronize_animation();
}
}
Re: Poseballs in sync?
Posted: Wed Apr 19, 2023 7:14 pm
by Graham Mills
A slightly more complex query to get round a couple of issues. Again, no idea whether it works but it phind.com does at least provide its reasoning and sources.
write a script in lsl for opensim that triggers an animation in two linked poseballs and then synchronises them. Check that the avatars give permission to be animated.
Code: Select all
// Define the animation name
string animation_name = "my_animation_name";
// Define the permission request message
string permission_request = "May I animate you?";
// Define the synchronization time
float sync_time = 2.0;
// Define the poseballs
integer poseball1 = 1;
integer poseball2 = 2;
// Define the avatars
key avatar1;
key avatar2;
default
{
state_entry()
{
// Set the poseballs to be physical
llSetStatus(STATUS_PHYSICS, TRUE);
// Set the poseballs to be phantom
llSetStatus(STATUS_PHANTOM, TRUE);
// Set the poseballs to be linked
llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_LINK_TARGET, poseball2]);
// Reset the poseballs' animations
llStopAnimation(animation_name);
}
touch_start(integer total_number)
{
// Get the key of the avatar that touched the poseball
key touched_avatar = llDetectedKey(0);
// Check if the avatar has given permission to be animated
if (llDetectedName(0) == touched_avatar && llDetectedType(0) & AGENT && touched_avatar != llGetOwner())
{
llRequestPermissions(touched_avatar, PERMISSION_TRIGGER_ANIMATION);
}
}
run_time_permissions(integer permission)
{
// Check if the avatar has granted permission to be animated
if (permission & PERMISSION_TRIGGER_ANIMATION)
{
// Get the key of the avatar that granted permission
key granted_avatar = llGetPermissionsKey();
// Check if this is the first avatar to grant permission
if (avatar1 == NULL_KEY)
{
// Set the first avatar as the granted avatar
avatar1 = granted_avatar;
// Start the animation for the first poseball
llStartAnimation(animation_name);
// Sit the first avatar on the first poseball
llSitTarget(<0.0, 0.0, 0.0>, ZERO_ROTATION);
}
// Check if this is the second avatar to grant permission
else if (avatar2 == NULL_KEY)
{
// Set the second avatar as the granted avatar
avatar2 = granted_avatar;
// Start the animation for the second poseball
llStartAnimation(animation_name);
// Sit the second avatar on the second poseball
llSitTarget(<0.0, 0.0, 0.0>, ZERO_ROTATION);
// Synchronize the poseballs after the specified time
llSetTimerEvent(sync_time);
}
}
}
timer()
{
// Unlink the poseballs
llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_LINK_TARGET, LINK_THIS]);
// Reset the avatars' keys
avatar1 = NULL_KEY;
avatar2 = NULL_KEY;
// Stop the timer event
llSetTimerEvent(0.0);
}
}
Re: Poseballs in sync?
Posted: Wed Apr 19, 2023 7:20 pm
by Koshari Mahana
.
Thank you so much! I wonder if this means I need to name the poseballs "poseball1" "poseball2" etc... or if that's just the script referring to them?
.
Graham Mills wrote: ↑Wed Apr 19, 2023 7:14 pm
A slightly more complex query to get round a couple of issues. Again, no idea whether it works but it phind.com does at least provide its reasoning and sources.
write a script in lsl for opensim that triggers an animation in two linked poseballs and then synchronises them. Check that the avatars give permission to be animated.
Code: Select all
// Define the animation name
string animation_name = "my_animation_name";
// Define the permission request message
string permission_request = "May I animate you?";
// Define the synchronization time
float sync_time = 2.0;
// Define the poseballs
integer poseball1 = 1;
integer poseball2 = 2;
// Define the avatars
key avatar1;
key avatar2;
default
{
state_entry()
{
// Set the poseballs to be physical
llSetStatus(STATUS_PHYSICS, TRUE);
// Set the poseballs to be phantom
llSetStatus(STATUS_PHANTOM, TRUE);
// Set the poseballs to be linked
llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_LINK_TARGET, poseball2]);
// Reset the poseballs' animations
llStopAnimation(animation_name);
}
touch_start(integer total_number)
{
// Get the key of the avatar that touched the poseball
key touched_avatar = llDetectedKey(0);
// Check if the avatar has given permission to be animated
if (llDetectedName(0) == touched_avatar && llDetectedType(0) & AGENT && touched_avatar != llGetOwner())
{
llRequestPermissions(touched_avatar, PERMISSION_TRIGGER_ANIMATION);
}
}
run_time_permissions(integer permission)
{
// Check if the avatar has granted permission to be animated
if (permission & PERMISSION_TRIGGER_ANIMATION)
{
// Get the key of the avatar that granted permission
key granted_avatar = llGetPermissionsKey();
// Check if this is the first avatar to grant permission
if (avatar1 == NULL_KEY)
{
// Set the first avatar as the granted avatar
avatar1 = granted_avatar;
// Start the animation for the first poseball
llStartAnimation(animation_name);
// Sit the first avatar on the first poseball
llSitTarget(<0.0, 0.0, 0.0>, ZERO_ROTATION);
}
// Check if this is the second avatar to grant permission
else if (avatar2 == NULL_KEY)
{
// Set the second avatar as the granted avatar
avatar2 = granted_avatar;
// Start the animation for the second poseball
llStartAnimation(animation_name);
// Sit the second avatar on the second poseball
llSitTarget(<0.0, 0.0, 0.0>, ZERO_ROTATION);
// Synchronize the poseballs after the specified time
llSetTimerEvent(sync_time);
}
}
}
timer()
{
// Unlink the poseballs
llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_LINK_TARGET, LINK_THIS]);
// Reset the avatars' keys
avatar1 = NULL_KEY;
avatar2 = NULL_KEY;
// Stop the timer event
llSetTimerEvent(0.0);
}
}
Re: Poseballs in sync?
Posted: Wed Apr 19, 2023 7:34 pm
by Graham Mills
poseball2 as below is simply a reference to the integer link number.
llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_LINK_TARGET, poseball2]);
Could you otherwise use something like PMAC?
https://github.com/uriesk/pmac
Re: Poseballs in sync?
Posted: Wed Apr 19, 2023 8:48 pm
by Koshari Mahana
Yes, let me check that. I tried both of the scripts above and I guess I don't know how to use them. ie: do the avatars sit on the poseballs, do they click on the root rotating prim, do they click on the first avatar etc... I remember in SL I had meditation cushions that I made and all I remember is having them linked to the root prim and they all just were in sync, I don't remember doing anything special (that doesn't mean I didn't. Thanks again, I'll try the link you sent.
Graham Mills wrote: ↑Wed Apr 19, 2023 7:34 pm
poseball2 as below is simply a reference to the integer link number.
llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_LINK_TARGET, poseball2]);
Could you otherwise use something like PMAC?
https://github.com/uriesk/pmac