Delete object with script?
-
ok, thats okej, cause the objects that touch "Box B" should not appear again after the simulation, the model I working on is a scripted bowling alley.
The pins are emitted down on to the lane, and when a ball pull the pins down and back off the lane it will be deleted. Thats is how I want it to be:P
so is there a script that delete everything that it touch, so would I be pleased to now that. It would be awesome. (I think)
Thanks,
Sorry for bad english, its early in the morning here in Sweden right now.
/hpnisse -
Why not 'hide' them or move them onto an invisible layer ?
Then you can always 'unhide' or move them back onto a visible layer ?? -
This should be done in the physics simulation, so if there is to much "pins" in the model at the same time the physics will run slowley.
And when I hide the pins after they thrown down there will take up a lot of space.
But I can test with hide the pins and ball when they fall down back of the lane, and see if the physics simulation will run slowley.
The best thing would be to delete them cause there will be new pins emitted down on to the lane when a new "Round" will start.
But if there is a script that delete everything that it touch, would I be pleased to know that.thanks TIG for the hide tip, I would try that.
/hpnisse
-
The hide idea would not work that well, so a script to delete objects when ontouch will probably work better:P (I hope)
But thanks for the idea./hpnisse
-
@hpnisse said:
The hide idea would not work that well, so a script to delete objects when ontouch will probably work better:P (I hope)
But thanks for the idea./hpnisse
If the objects are groups moving them to an invisible layer would both hide them and remove them from interactions ?
-
Hiding an object in SP doesn't affect the simulation, as far as the Physics engine is concerned the object is still present and movable, you just can't see it. Deleting a group is simple, you just get the group handler and use '.erase!', but I don't know how this would affect the sim
-
What is the "Group handler"? Im searching for help in
http://code.google.com/intl/sv-SE/apis/sketchup/docs/ourdoc/group.html
but I can't find anything that I understand.So a little more precise instruction would be great!
The idea is to delete groups/components when they touched another group./hpnisse
-
The group's script 'object'. E.g. you've probably come across $curEvalGroup before, that is actual a variable, set to the current group's script object. It's just 'Group' on the API.
-
Hello again!
I have seen the "$curEvalGroup" before, but I did't understand everything. I have test everything I come up with.
Can Wacov (or someone else) explain the "group handler", it sounds so simple when you say it.
@unknownuser said:
you just get the group handler and use '.erase!'
/WacovAnd when I test a few examples and combinations with ".erase!" the simulation will freeze, the only that works is to stop the simulation.
So a little more careful explanation would be helpful.
/hpnisse
-
u should only ever delete objects created in simulation, eg emitted objects
Advertisement