View Full Version : Lscript woes...

07-18-2006, 02:47 AM

No apparent method to get non keyed motion from ma object. Seems liek a fairly basic thing to need. I have seen a workaround, which isn't working for me. Thoughts, suggestions.

I have put too much time learning/beating my head against my moniter to give up my first Lscript to the learning gods. I will make it work.

07-18-2006, 04:53 AM
What are you asking precisely?

07-18-2006, 08:32 AM
Sorry, in my sleep driven haste, I neglected to offer a good explanation.

Basically, as I understand it, when using the ma.get(POSITION, time) method, you are only able to get keyed motion. I agree that this makes sense. It is important to able to record keyed frames. But, say for instance that you are setting up a motion that that would require one to calculate the position vector every frame.

I'm trying to create a gravitational motion affector. I have created a loop over all the children of a parent object. I am able to get the positions of all the children, but I have no way of "getting" the current frame of the object in which the Lscript is applied, at least that I know of, unless it has been keyed.

What occurs is that the "get" method only retrieves the vector of the last keyed frame or interpolates between keyed frames. Gravitational motion, however requires that the vector between two bodies be calculated at ever time step. I hope this is a little more clear.

Thanks for all the help. Sorry if I have double (triple) posted.

07-18-2006, 01:38 PM
It actually means you can get the motion at any point, not just on key frames, but it won't pick up motions after they have been altered by motion modifiers. This is a limitation which hopefully will be looked at during the 9 cycle..

07-18-2006, 10:04 PM
Interestingly enough, it will pick up the motions of children of parents. If the channel is called from on with a "nextchild" function, it will get the modified vector, even if it has a motion modifier attached.

I am away from my computer right now, however, my plan of attack is this:

obj = ma.parent
vcur = obj.nextchild().get(POSITION,time)

or something like this. I am actually running a loop over all the children, so I have to determing which object is the motion access modifier. My next attempt is to compare strings:

par = ma.parent
cstring = string(ma.objID)
if( string(obj.nextchild()) = cstring)
currentobjvector = obj.nextchiled()

or something like that. I'll tell you all how it goes. i will cut off my left big toe if it doesn't work.

07-19-2006, 09:51 PM
Ok, that didn't work... now I'll try brute force. No wonder there aren't many motion modifier lscripts ou there.

07-19-2006, 10:29 PM
Question, to all you Lscripters/programmers out there: How much more difficult is, say programming a motion modifier in C, than the same modifier would be in LScript? I understand that both, I am sure have their advantages. I also understand that this question is somewhat ambiguous.

07-19-2006, 11:39 PM
Alrighty, then.
Tried what I thought was an elegent workaround: because i am setting the objects position at every frame, I thought that I could store that position indexed by the frame, then pass the the stored value to the next frame and so on. Store() will not store and array. I feel like I have exhausted all the resources out there. If there are any other ideas or workarounds, I am going to move on to other things. I did learn how to write an lscript, though. Who thought that animating a ****ed bird would snowball into a 2-week long fiasco... don't ask.

07-20-2006, 12:14 AM
I'm not a scripter, but there also is an L-script mailing list for you programmer types. Do a search and you should find something.

07-20-2006, 08:14 PM
Yea, i know, sorry for cluttering up this space with my programming nonsense.

07-20-2006, 08:18 PM
Good luck man. Programming is hard. Did a quick search for you.

Shows a bunch of links, and at the bottom the lscript group. I think there is one that is more active. I don't know.

07-21-2006, 12:49 AM
Naw, I did a bunch of scripting in college for civil engineering stuff. Its not so much hard as it is challenging. I love problem solving.

07-21-2006, 03:35 AM
Have a look on my web page. There's a bunch of lscripts including some motion modifier scripts.