PDA

View Full Version : multiple object process ?



martinwcox
05-16-2003, 05:52 AM
hi everybody
I've tried to control the position of two objects within the same lscript but coudn't get it. I don't know if I'm doing something wrong, I've just started to programm lscripts. For example, trying to get the distance between two objects:


process: ma, frame, time
{
pos = ma.get(POSITION, time);
posb = obj.get(POSITION, time);
dist = vmag(pos - posb);
}
but it does not work
how could I do such a simple thing?
thanks for help
martinwcox.-

faulknermano
05-17-2003, 10:13 PM
use the set method like:




...
myPos = <0,0,0>
ma.set(myPos);
...




btw: i dont think you control two items from one lscript instance. you can apply the same lscript to the other item, but you must create an instance of that script. one item -> one script instance.

martinwcox
05-18-2003, 03:42 AM
well maybe not really controlling other objects, but obtaining dynamic information about them (position, etc). C'mon, it's so easy to do it with an expression, there must be a simple way to do it in lscript.

faulknermano
05-19-2003, 10:00 AM
actually, it is easy... :D






objectA = Mesh("Object_A");
objectB = Mesh("Object_B"); // assuming Object_B is a mesh object

objectA_pos = objectA.getWorldPosition(Scene().currenttime);
objectB_pos = objectB.getWorldPosition(Scene().currenttime);

dist = vmag(objectB_pos - objectA_pos);



DO NOT, however, attempt to get the position of the item that the script is applied to through the use of the ma.get(POSITION,time) method. this will not work because of the way the process function is called in motion scripts.hard to explain rigth now (gotta go). :D