question

Khalid Kayal avatar image
1 Like"
Khalid Kayal asked Khalid Kayal commented

How to add multiple collison members at once?

I have multiple forklifts that I need to add them together in their collison member lists so it activates collision trigger. I have tried to write a code :

getvarnode(Object1,"collisionobjects").subnodes[1].value = Object2

But it doesn't seem to work. Is there a way I can add members faster than manual process ?

With the manual process is there a way to select multiple objects in the collision members list?

Thanks in advance,

Khalid

FlexSim 17.1.1
collision problem
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Majid A avatar image
2 Likes"
Majid A answered Khalid Kayal commented
//Method to add a collision member through code
treenode op1 = node("Operator1", model());
treenode op2 = node("Operator2", model());


if (not(objectexists(op2))) return(0);


nodeinsertinto(node(">variables/collisionobjects",op1));
nodeadddata(last(node(">variables/collisionobjects",op1)),3);
setname(
  last(node(">variables/collisionobjects",op1)),
  getname(op2)
);


nodeinsertinto(node(">variables/collisionobjects",op2));
nodeadddata(last(node(">variables/collisionobjects",op2)),3);
setname(
  last(node(">variables/collisionobjects",op2)),
  getname(op1)
  
);

nodejoin(
  last(node(">variables/collisionobjects",op1)),
  last(node(">variables/collisionobjects",op2))
);

return 1;


· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Khalid Kayal avatar image Khalid Kayal commented ·

Thanks Majid

0 Likes 0 ·