These forums are CLOSED. Please visit the new forums HERE
small rotation loop with easing |
|
Naiman Broome
Registered User
Join date: 4 Aug 2007
Posts: 246
|
07-13-2008 05:13
Hello how can be like as cript that makes rotate of a small degree a prim then slowly decreasing the rot speed untill to rverse it on the opposite side and then back again in a loop?
|
Ollj Oh
Registered User
Join date: 28 Aug 2007
Posts: 522
|
07-13-2008 10:53
for a fixed range just use: float t;
t=t+TWO_PI/100; if (t>TWO_PI) t=t-TWO_PI; rotation = <llSin(t)*factor+summand,0,0>; //factor and summand just set the max and min rotation range while llSin(t)t will fluctuate from -1 to 1 without them. or for a variable target to reach: rotation must be sigmoid. rotation speed be a bell curve. http://en.wikipedia.org/wiki/Normal_distribution But thats way too much uneccessary math... To reach a target rotation as fast and smooth (as in accelleration efficient) as possible each value (xyz rotation) needs variables to store; target_value and current_speed and current_value (read per function and not needed to store) then calculate: reached_by_constant_speed = current_value + (target_value - current_value)*current_speed*1.1 //this calculates where it would be without any speed change in 1.1 steps (we calculate 0.1 steps ahead because we are carefull" ![]() if (reached_by_constant_speed < target_value) {accellerate} else if (reached_by_constant_speed > target_value) {decellerate} This if-setting is for a linear range and not for full circles, as it takes no 2/12 rotation shortcut from 11/12 to 1/12 but it will go 10/12 the other way around because it does not calculate the shortest path within a circle. You must also ensure that speed and current_value do not go out of controll by becoming very large or very small (rounded to 0) values. |
Naiman Broome
Registered User
Join date: 4 Aug 2007
Posts: 246
|
07-13-2008 12:06
Ehrm ... thankyou but .... how would look that in a script?
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
07-15-2008 10:44
Try these. They use damping just like llMoveToTarget() type positional functions:
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llLookAt http://www.lslwiki.net/lslwiki/wakka.php?wakka=llRotLookAt |
Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
|
any updates here?
12-03-2008 08:23
This thread is exactly what I was looking for, a horizontal rotation that slows to a stop and then reverses direction with this action looped. If any one has a script to share I'd appreciate it. Heck, I'd evenb uy something if it was full perm so I could see how it works.
I am currently using a Swing script but it is jerky and runs at one speed. Thanks |
perfumed Odets
Registered User
Join date: 7 May 2006
Posts: 363
|
I would like to buy this script
12-08-2008 17:53
if anyone has it made also.
thanks |
Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
|
12-08-2008 18:07
Guess I'd pay too for a full perm version, I'd love to see how to do it.
|
Void Singer
Int vSelf = Sing(void);
![]() Join date: 24 Sep 2005
Posts: 6,973
|
12-08-2008 20:34
it's horribly inaccurate as far as exactly splitting the amount or the total rotation, but something starting at one edge or the rotation and progressing to the other end, with the largest movents in the middle CAN be done this way....
CODE
first call reverses the rotation and breaks off a large chunk, then the next line applies it. second change restores part of the original, making a larger rotation segment, and continues to apply it third call should bring it back to the original rotation amount, and applies that. next two changes refractionalize the rotation progresively and apply them final change restores the rotation amount. this lets you preserve the original rotation amount between timer calls, so that it can be used to re(pre?)set the position of the object to it's center position PLEASE NOTE while rot.s *= 2; may visually look like you're splitting the rotation in half, it is NOT precise for that purpose, but it is pretty close, so it's workable for subdividing the rotation for things like mimicing gravity... it works because quaternions (rotations) can represent changes in size and rotation, but LSL only is concerned sith the rotation portion, so normalizes the rotation. what we're doing is changing the magnitude, which is then renormalized, resulting in a change in the rotation amount. other multipliers/divisors may be better suited depending on your rotation amount, but the concept is workable. _____________________
|
| . "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... | - |
Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
|
12-08-2008 20:53
Thanks Void,
Can I trouble you to flesh that out a bit, i assume a SetTimerEvent is needed to get that to work? It's a curse not having a programer brain. I look at that and go "huh?" but once it is in a working form I go "Oh, now I see". |