| Scripting Discuss scripting and programming for SL and other platforms |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| gone ![]() ![]() ![]() Join Date: Sep 2007 Location: in the home I haven't built yet
Posts: 2,321
My Mood: | llSetKeyFramedMotion across sim boundaries? My shiny new fixed-track vehicle using llSetKeyFramedMotion will not cross sim boundaries. It gets just within the new sim, and stops. If I issue a PAUSE command, followed by a PLAY command, it resumes the motion as if notihing happened. However, that's not something I want to have to do at every sim crossing - I was hoping to ignore them! So then I tested the same thing using the simple "oscillation" script from the examples in the wiki description of llSetKeyFramedMotion. Same problem. That script is below. Has anyone gotten this command to work across sim boundaries? Code: // Harmonic oscillator motion by Dora Gustafson, Studio Dora 2012
// will oscillate a prim along a straight line in space
// only the first half period is computed, the second is the first in reverse
float phase=PI;
vector amplitude=< 0.0, 2.0, 0.0>; // amplitude and direction for oscillation
float Hperiode=3.0; // half periode time S
float steps=12; // number of Key Frames for a half periode
float step=0.0;
list KFMlist=[];
vector U;
vector V;
integer osc=TRUE;
vector basePos;
default
{
state_entry()
{
llSetMemoryLimit( llGetUsedMemory()+0x1000);
llSetPrimitiveParams([PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]);
basePos = llGetPos();
float dT = Hperiode/steps;
dT = llRound(45.0*dT)/45.0;
if ( dT < 0.11111111 ) dT = 0.11111111;
U = amplitude*llCos( phase);
while ( step < steps )
{
step += 1.0;
V = amplitude*llCos( PI*step/steps + phase);
KFMlist += [V-U, dT];
U = V;
}
}
touch_start( integer n)
{
llSetKeyframedMotion( [], []);
llSleep(0.2);
llSetRegionPos( basePos);
llSetPos( basePos);
if ( osc ) llSetKeyframedMotion( KFMlist, [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_PING_PONG]);
osc = !osc;
}
on_rez( integer n) { llResetScript(); }
} |
| | |
| |
| | #2 (permalink) |
| only mostly banned ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() *SLU Supporter* ![]() ![]()
paddling.....
Join Date: Jul 2009
Posts: 622
My Mood:
Business: Building in Motion
Client: References available on request. Blog Entries: 47 | I have used key frame motion across sim boundaries, but it is a mess. There have been times when a link set would not cross, but a single prim will. I have had issues with the physics shape on mesh if it is not convex, and a good amount of hair has been cleaned off the desk. Try using your script in a single, simple cube and see if it works. Then try it with a couple of cubes linked. If that works then try it in your complicated build. If that breaks then you may have to fiddle with the physics shape to make it as simple as possible. Sorry this is not more useful..... ![]() When it works, it is wonderful. When it does not it is very frustrating. Sort of like SL in general.
__________________ "From this proposition it will follow, when arithmetical addition has been defined, that 1+1=2." - Principia Mathematica, Russel and Whitehead, page 379 (1st ed.) |
| | |
| 1 User Laughed: |
| | #3 (permalink) |
| gone ![]() ![]() ![]() Join Date: Sep 2007 Location: in the home I haven't built yet
Posts: 2,321
My Mood: | I tested it using a simple box, and used a few different times to see if speed of crossing mattered. Nogo! Great to hear that it can be used, someday. Might you have a piece of code that seems to work? Or, does it seem to be sim-dependent? Meanwhilst, others are seeing the same problem, and a bug has been started: https://jira.secondlife.com/browse/SCR-345 Here's the LL forum thread on it: llSetKeyframedMotion() loses power crossing sim bo... - Second Life (Yes, that's how much I care about this. I actually SEARCHED LL's FORUMS! *shudder*) |
| | |
| | #4 (permalink) | ||
| That Bitch ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() *SLU Supporter* ![]() ![]() ![]() ![]() ![]()
Innocent as far as you know
Join Date: Nov 2011 Location: Online
Posts: 6,204
My Mood: SL Join Date: late 04... that account is deleted now | I've been watching that mess too... have you tried using the changed event with CHANGED_REGION to issue the pause/play combo? might be fast enough to overcome the problem.... you might even get away with putting both commands in the same call.
__________________ - These eyes can do more than see Quote:
Quote:
| ||
| | |
| | #5 (permalink) |
| only mostly banned ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() *SLU Supporter* ![]() ![]()
paddling.....
Join Date: Jul 2009
Posts: 622
My Mood:
Business: Building in Motion
Client: References available on request. Blog Entries: 47 | I am not sure what you did, but you broked it. I went to Rodel to the very edge of the sim, Second Life Maps | Rodel , and tried out this script: Code: default
{
state_entry()
{
llOwnerSay("touch me you fool.");
}
touch_start(integer total_number)
{
//llSetKeyframedMotion([],[KFM_COMMAND,KFM_CMD_STOP]);
llSetKeyframedMotion([<3.0,0.0,0.0>*llGetRot(),ZERO_ROTATION,2.0],
[KFM_MODE,KFM_FORWARD,KFM_DATA , KFM_TRANSLATION|KFM_ROTATION]);
}
} I could drag it back to Rodel, and it worked. Sometimes it would cross the sim, though, and not stop. It would just keep going. No matter what. I could not get it to work in the other sim. I tried to reset the script, added the stop command, and nothing. Rodel worked okay but not in the next sim. I hope that you are proud of yourself..... Edit to add: Ugh.... went back and tried a few things. Rezzed a big complicated mesh thingie in the center of the sim and started it off. The thing stopped at the sim boundary just like you described. :-( Last edited by Grandma Bates; 06-05-2012 at 04:39 AM. Reason: a bit to add |
| | |
| | #7 (permalink) |
| gone ![]() ![]() ![]() Join Date: Sep 2007 Location: in the home I haven't built yet
Posts: 2,321
My Mood: | I didn't do it! That Jaiden guy on LL's forums clearly is to blame, because he noticed it sometime before May 24th! Looking at your test script, I notice that you might be running afoul of another llKfM bug (as I did). Once my test box crossed a sim border and I did the PLAY command once, subsequent llKfM commands wouldn't work at all. As a workaround for that, I had to change the test script I had posted on the Jira to have two translations instead of just one in the llKfM command, e.g.: llSetKeyframedMotion([ZERO_VECTOR,5.0/45.0, DELTA, DURATION], [KFM_DATA, KFM_TRANSLATION]); I tried this because of the last comment on a different bug llSetKeyframedMotion skips first frame after crossing a sim border When I put two translations in the command, the box would at least move back over the sim border when I gave it another llKfM call, albeit only JUST over the border! Aaaand, I just noticed that I spazzed when I wrote up this separate problem in my comment on SCR-345 and transposed two digits in SVC-7942. Dammit! Jaiden made me do it! |
| | |
| 1 User Said Thanks: |
![]() |
| Thread Tools | |
| Display Modes | |
| |
| |