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
  1. //Method to add a collision member through code
  2. treenode op1 = node("Operator1", model());
  3. treenode op2 = node("Operator2", model());
  4.  
  5.  
  6. if (not(objectexists(op2))) return(0);
  7.  
  8.  
  9. nodeinsertinto(node(">variables/collisionobjects",op1));
  10. nodeadddata(last(node(">variables/collisionobjects",op1)),3);
  11. setname(
  12. last(node(">variables/collisionobjects",op1)),
  13. getname(op2)
  14. );
  15.  
  16.  
  17. nodeinsertinto(node(">variables/collisionobjects",op2));
  18. nodeadddata(last(node(">variables/collisionobjects",op2)),3);
  19. setname(
  20. last(node(">variables/collisionobjects",op2)),
  21. getname(op1)
  22. );
  23.  
  24. nodejoin(
  25. last(node(">variables/collisionobjects",op1)),
  26. last(node(">variables/collisionobjects",op2))
  27. );
  28.  
  29. return 1;
  30.  
  31.  
· 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.