PDA

View Full Version : Trying to find plugin : Automatic banking


Dr Dardis
02-23-2003, 05:15 AM
Hey everybody,

Tried flay and all the usual spots, I am desperately trying to find a plugin I saw floating around ages ago that does automatic banking

ie: if you keyframe the flying motion of a plane, then this plugin will take care of the bank angle for you.

If anyone knows where to find it, or has a copy of it floating around in their plugin directory, please let me know, it will save my butt.


Thanks in advance,

The good Docter.:)

faulknermano
02-23-2003, 09:56 AM
hi doc. :)

i think lw5.5 did this once upon a time. wonder why this isnt in lw7.5


anyway, i cooked up something for you (cooked before, that is..)


// begin Banker Motion Modifier script
@warnings
@script motion
maintain;
sensitivityMultiplier;
lookaheadTime;
bankLimitsBool; bankLimitLow; bankLimitHigh;
maintain;
sensitivityMultiplier;

flags
{
return(AFTERIK);
}
process: ma, frame, time
{
// get velocity

nowRot = ma.get(ROTATION,time);

thenRot = ma.get(ROTATION,time + lookaheadTime);

fRot = thenRot - nowRot;

if(!maintain)
fv = <nowRot.x,nowRot.y,-fRot.x * sensitivityMultiplier>;

if(maintain)
fv = <nowRot.x,nowRot.y,(-fRot.x * sensitivityMultiplier) - thenRot.x>;

if(bankLimitsBool)
{
if(fv.z < bankLimitLow)
fv.z = bankLimitLow;
if(fv.z > bankLimitHigh)
fv.z = bankLimitHigh;
}

ma.set(ROTATION,fv);
}

create: obj
{
setdesc("Su-75 Banker");
lookaheadTime = .03;
bankLimitsBool = false;
bankLimitLow = -90.0;
bankLimitHigh = 90.0;
sensitivityMultiplier = 4.0;
maintain = false;


}
options
{
// bank limit, look ahead, sensitivity multiplier, additive?
reqbegin("Su-75 Banker");
c1 = ctlnumber("Look Ahead Time \(Secs\)",lookaheadTime);
c2 = ctlcheckbox("Enable Banking Limits",bankLimitsBool);
c3 = ctlangle("Bank Limit Low",bankLimitLow);
c4 = ctlangle("Bank Limit High",bankLimitHigh);
c5 = ctlnumber("Heading to Bank Sensitivity Multiplier",sensitivityMultiplier);
c6 = ctlcheckbox("Maintain Bank Value on Straightaways",maintain);

ctlactive(c2,"active_bank",c3,c4);

return if(!reqpost());

lookaheadTime = getvalue(c1);
bankLimitsBool = getvalue(c2);
bankLimitLow = getvalue(c3);
bankLimitHigh = getvalue(c4);
sensitivityMultiplier = getvalue(c5);
maintain = getvalue(c6);

reqend();

}
active_bank: val
{
return(val);
}

save: what, io
{
if(what == SCENEMODE)
{
io.writeln(lookaheadTime);
io.writeln(bankLimitsBool);
io.writeln(bankLimitLow);
io.writeln(bankLimitHigh);
io.writeln(sensitivityMultiplier);
io.writeln(maintain);
}
}

load: what, io
{
if(what == SCENEMODE)
{
lookaheadTime = number(io.read());
bankLimitsBool = integer(io.read());
bankLimitLow = number(io.read());
bankLimitHigh = number(io.read());
sensitivityMultiplier = number(io.read());
maintain = integer(io.read());
}
}
// end script


note that there are some options. Look Ahead Time and Banking Limits are explanatory. Sensitivity Multiplier is the 'heading to banking ratio'. this is pretty arbitrary... the default value of four seems to be okay. Maintain Bank along Straightaways will tell the script to keep the bank and not straigten itself to zero if there is no 'rotation velocity', or rotation change. if that's confusing then it will become more apparent when you use the script.

if there are bugs or problems, PM me or email me here (preferred)

faulknermano1@yahoo.com


ps: can i get a free checkup now? :D

Jonathan
02-23-2003, 10:04 AM
In most forums that I run into, scripting and expressions are the subjects most avoided. It's a shame too. I've copied your script and I'm going to try it later

Good Job:thumbsup:

wgreenlee1
02-23-2003, 10:23 AM
Me to.
Looks real useful like "Follower" but "Banker" instead.
Thx Faulknermano!

BTW,whats "ma.","fv",and ".io" refering to in this instance?(If you dont mind.)

Eugeny
02-23-2003, 10:47 AM
Just checked it ...
Work great except the limits - then i add some limits the banking disappear :hmm:

faulknermano
02-23-2003, 02:34 PM
Originally posted by wgreenlee1
Me to.
Looks real useful like "Follower" but "Banker" instead.
Thx Faulknermano!

BTW,whats "ma.","fv",and ".io" refering to in this instance?(If you dont mind.)

"ma" is called as a the object agent of the item that is being assigned the lscript. this is done automatically by lscript. if you see the process() function, you will see ma, time, frame. that is pre-defined. the ma contains the object agent.

when i use ma.get(ROTATION,time), i'm telling lscript to access the object agent (which contains stuff) and get it's rotation.

fv, if you look at the rest of the process function() is a vector value that was the result of some simple calculation. using variable messages, i can extract the first number from the vector by typing "fv.x", or if i want the third: "fv.z" and so on.

"io" is almost the same as "ma" but it refers the File Object Agent. whenever you save or load something, and if there is an callback lscript n the scene (just like this script) the script will execute the save() or load() functions. accessing "io" will enable me to access the scene file upon save or load. this is primarily used to save settings.

io.writeln("blah");

that code will write "blah" on the plugin settings in the scene file. :)

oh yeah, if anyone noticed i named the script Su-75 Banker. if anyone is familiar with the Russian warplane... :)

faulknermano
02-23-2003, 02:36 PM
Originally posted by Eugeny
Just checked it ...
Work great except the limits - then i add some limits the banking disappear :hmm:

if it's no problem, do you think you can go step by step with what you did so i can determine if it's indeed a problem or pilot error? thanks. :)

Eugeny
02-23-2003, 02:48 PM
I have only one day - tomorrow till the next our big project is come in up, so if u want we can make it tomorrow ...

faulknermano
02-23-2003, 03:13 PM
Originally posted by Eugeny
I have only one day - tomorrow till the next our big project is come in up, so if u want we can make it tomorrow ...

whenever you find it convenient. i would just like to know, as precisely as possible, the circumstance in which the banking disappears.

and btw, i forgot to mention in the comments: you have to switch _at least_ your heading controller to Align To Path. the script needs the aligned path info.

Eugeny
02-23-2003, 03:23 PM
:) Yes i realized that fact (switching ON)

The banking disappear then u turn ON the "Enable Banking Limits" - there is some strange numbers appears (see attachment) but even with playing with ranges the banking is not working ...

faulknermano
02-23-2003, 04:36 PM
super strange.. first, the 'strange numbers' are not supposed to look like that at all. are you running lw6.5b? actually more importantly, what lscript version are you running?

it works fine over here. i cant think of anything else... could you recheck the lscript to make sure you've included everything above? that's all i can think of.

faulknermano
02-23-2003, 04:42 PM
the only clue i have is that those numbers in the low and high limits are actually expressed in radians: that's why i asked if you have an earlier version of lscript (it _may_ have been an old bug -not sure - that's must have been rid of in the latest lscript: v.2.5.1).

if, and only if this is the case, then simply replace the lines containing "ctlangle" (in the options function()) with "ctlnumber".

see if that works..

Eugeny
02-23-2003, 04:46 PM
I'm running 7.5 on Win2k PC ...
Actually i made copy/paste from the html page to text document and then changed the .txt extension to .ls ...
May be i have not updated Lscript ?
How i can check this ?

Eugeny
02-23-2003, 04:51 PM
Yes that those the problem , after replacing it's working great :thumbsup:
Thanx for the script :wavey:

faulknermano
02-23-2003, 05:03 PM
Originally posted by Eugeny
Yes that those the problem , after replacing it's working great :thumbsup:
Thanx for the script :wavey:

:thumbsup: cool. glad it's working.

i might update certain parts of the script especially in regards to the "maintain bank along straightaway". it doesnt work as i want it to... oh well... this was for the doctor anyway. :D

ClingFree
02-23-2003, 06:12 PM
Great script Faulknermano, I'm flyin' now. I really need to learn scripting one of these days. :thumbsup:

kretin
02-23-2003, 09:45 PM
Thankyou faulknermano, you're a godsend. I never did work out why the banking option was taken out out of align to path...

wgreenlee1
02-23-2003, 09:50 PM
oh yeah, if anyone noticed i named the script Su-75 Banker. if anyone is familiar with the Russian warplane...


Ok, I will change the name...
I called it "faulk_banker.ls".....:thumbsup:

faulknermano
02-24-2003, 12:56 AM
Originally posted by wgreenlee1
Ok, I will change the name...
I called it "faulk_banker.ls".....:thumbsup:

i feel insecure. haha. :D

Dr Dardis
02-24-2003, 02:01 AM
I love it! The spirit of generosity lives. Did just what I needed it to, saved me about 10 hours work.

:thumbsup:

Thanks again, and to all the people who have replied to the thread, its good read all the input!

nuff r'spec

the good Docter.

(well good, but not THAT good :) )

antonv
02-26-2004, 06:25 PM
Hi guys,
i am really new to LW and i tryed to install the script, but nothing happens. I copyed it in a text document, changed extension to .ls and i put it in scripts folder under LW. I this the way to do it? When i oppened LW nothing happens. Could you please explain to me how to do it?

Thank you,
Anton

Dr Dardis
02-27-2004, 03:36 AM
Hi vasilescu_anton

You have to tell Lightwave to load the LS in the same way it does plugins, then it should be visible under the motion plugin dropdowns

Chris.

CGTalk Moderation
01-14-2006, 12:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.