FreeSpace Releases > Scripting Releases
remote controlled turrets revisited
Bobboau:
oh, my god you have no idea how ****ed up the turret\subobject rotation system is. the turrets have copys of matraceise made from the positions of there guns used to figure out were there target is but not to rotate the model there are like four seperate matraciese that are for diferent aspects of that (when all of this could be handled by one) and then I added another matrix into the mess fortunately I blocked it off whenever I could (and WOW was that ever a hack). and there is always the ever present issue of the agnles2matrix function being about as acurate as rolling a rock down a mountainside.
my code should be all in now, so he's going to have to deal with it post merge, wich is better for both of us realy.
Nuke:
well im sorta thinking about what id need to do fully scripted turrets which dont even touch the internal c code. rc turrets are doable as is but the trickey part would be to interface a scripted turret with ai. i sorta want some functions that use orientations, like createWeapon() to have the option of using a normal instead. i really dont think anyone would notice if a prometheus shot is on its side, or a missile either. also cameras would be better if handeled by normals, then you can just set the normal to whatever you want to "film" and maybe another to say which end is up, sorta like a tripod axis. ive spent the last 3 or 4 days trying to understand the math behind matricies and i still dont get it.
anyway i was meaning to ask you bob if that thing in your turret build that lets us set the front, up and side axes is used to create an orientation matrix. if so id love to have that function in scripting. i dont need to understand matricies if i have a function that makes one for me.
Bobboau:
well, it's a commonly used function within the code base, actualy it's such a minor thing I think the actual function doesn't get used that much.
if I knew how to make a function with optional parameters for LUA I'd have it done by the time it took ne to write this responce.
in the code getting/setting an fvec is literaly matrix.fvec,
there is a vm_vector_2_matrix(matrix *m,vec3d *fvec,vec3d *uvec,vec3d *rvec) function you'd probly like access too as well (the nice thing about that function is the last two parameters can be set to NULL and it'll fake them for you)
Nuke:
im not really sure if most of the built in functions im calling are written in c or in lua. anyway alot of stuff i want to do requires manupulatiion of spacial stuff, theese include:
ils carrier landing
atmospheric flight physics
battlemechs :D
freelancer style flight/turret control
blindfire weps
rtt panel gauges/working controls
ect.
WMCoolmon:
--- Quote from: Bobboau on January 20, 2007, 09:58:28 am ---if I knew how to make a function with optional parameters for LUA I'd have it done by the time it took ne to write this responce.
--- End quote ---
You use a pipe (|) along with the normal format characters, so for a function like you're thinking, you'd do something like:
--- Code: ---ade_get_args(L, "o|oo", l_Vector.Get(&fvec), l_Vector.Get(&uvec), l_Vector.Get(&rvec));
--- End code ---
Everything after the pipe is considered as optional by Lua, and the variables are left alone unless they're set to something.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version