PDA

View Full Version : hope not a stupid question



kief
01-07-2004, 08:39 PM
how on earth do have the value and a variable increase incrimentally with a motion script? for instance, if the velocity changes from negative to positive, then everytime it changes that value of that variable will increase by one. in other words, is it possible to use event(UDF) with a motion script or is there any other possible ways of doing this?

thanks

kief

kief
01-08-2004, 09:36 PM
well, since it seems that this isn't possible, and i don't want to start another thread...
how do i make a component of my interface uneditable and at the same time display the value of an envelope that i have created?

Thanks to all from this small (must have to do with the horrendous manuals) community of lscripters!!!!

kief

faulknermano
01-12-2004, 04:04 AM
Originally posted by kief
how on earth do have the value and a variable increase incrimentally with a motion script? for instance, if the velocity changes from negative to positive, then everytime it changes that value of that variable will increase by one. in other words, is it possible to use event(UDF) with a motion script or is there any other possible ways of doing this?

thanks

kief

the process() func callback willl afford you the means to do checks, although i wouldnt recommend it. have you tried using the event() UDF at all? sometimes it is not documented and find out that indeed it works. i havent used it myself though.

but here's some suggestions when writing motion scripts:

you have to think different when you are writing motion scripts. i recommend NOT THINKING ON-DEMAND CALCULATIONS. meaning when you are writing motion scripts, pretend that the script will precalculate everything, and that you cannot get 'real-time' (e.g. on-demand) variables from layout. everything is 'pre-set.' hope i'm getting myself across.

i think i know where you are coming from when you want to refer to a velocity to determine how your script works. the problem, i think that i see, is that the way you have set up your velocity data to be retrieved. maybe 'baking' or taking a 'snapshot' of the velocity at predetermined points within the whole motion path is the way to go.. i dont know.. that's just a thought.

edit: to briefly explain why should shouldnt do checks on process() funcs in motion scripts: IA scripts will call process funcs at 'unpredictable' times. i say unpredictable because it is not documented (and it doesnt have to be). it calls whenever layout wishes for it to be called. for instance, when you have motion path turned on, layout will call the motion script so it can plot out the motion. another example: when motion blur is turned on, layout calls the motion script on render time and refers to a span of frames directly related to how much motion blur there is. if you understand how motion scripts work you will code them differently. also remember that layout calls the process() funcs MANY times... in motion blur alone, it may six or more times PER FRAME, to account for the object's positions within a frame to properly render the blur. in this case, you had tried to do increments, you would likely lose track of the variable and the increment, because process would probably been called so many times and the data that you have is not the data that you need.

anyway, that wasnt really brief.. sorry... :D

faulknermano
01-12-2004, 04:08 AM
Originally posted by kief
well, since it seems that this isn't possible, and i don't want to start another thread...
how do i make a component of my interface uneditable and at the same time display the value of an envelope that i have created?

Thanks to all from this small (must have to do with the horrendous manuals) community of lscripters!!!!

kief


first question: use ctlactive()

second question: it is simple matter of getting the value from the envelope and updating the variables in question on a ctlinfo() callback. i am not sure, however, if you can use a 'traditional' control to refresh dynamically.. if you can, then use setvalue() to change those controls' variables. but i know ctlinfo() (and even reqpost()) will refresh your drawing funcs on specified milliseconds. therefore, you should display your info by using the reqdraw funcs, instead of the traditional ones like ctltext().

kief
01-12-2004, 10:53 AM
thanks for all the help.

i am finding the velocity of goal objects by finding the position of the objects one frame ahead and one frame behind, subtracting those value together, then dividing them the difference of the time of one frame ahead and one frame behind the current frame. it not totally accurate, but it is close enough as long as you don't have a drastic change in velocity from one keyframe to the next. the idea of the script is to automatically move a character with a simple walk cycle forward without feet sliding or anything like that. the two feet goal switch off "pushing" the entire character forward, that's one place the velocity comes in. if the velocity of that certain goal is positive then the opposite goal does the propelling. so far the character moves forward using the alternating feet goals but "jumps" back every time the grounded foot switches. so to compensate for that, i will have an integer multiple the position every step. i came to the conclusion (whether i am totally correct or not ???) that doing it incrimentally, where the second use of velocity was going to come in, would be way too far beyond my ingenuity with lscript (thanks for the pointer with motion scripts faulknermano), so i am planning on having the user specify which frame the grounded foot changes using an evelope and setting the curve of that envelope to stepped.

now, the problem that i am having is that i want to have the user click an "add" button and then that will add a key frame and set the curve to stepped. so far no luck. shouldn't that be relatively simple?



envelopeUDF
{
envelope.createkey(time);
envelope.setcurve(thisKey,CHAN_STEPPED);
}

faulknermano
01-13-2004, 05:43 AM
check your spelling. i think it's is supposed to be:




thisKey = env.createKey(time);
env.setKeyCurve(thisKey,CHAN_STEPPED);

kief
01-13-2004, 08:34 AM
thanks, you are probably right. i am at school so i can't check it out til i get home.

kief