## How to hide a dummy and cuboid grouped with it

Typically: "How do I... ", "How can I... " questions
coder212
Posts: 7
Joined: 10 Sep 2021, 13:29

### How to hide a dummy and cuboid grouped with it

I want to get cuboids continuously on a conveyor belt. To do this, I added a cuboid and a dummy. Then grouped that dummy under the cuboid (box). Then in the child script for the conveyor belt, I added a code to copy-paste boxes onto the conveyor belt.

Code: Select all

box = sim.getObjectHandle("Cuboid")
boxDummy = sim.getObjectHandle("BoxDummy")
Copy-pasting objects

Code: Select all

insertedObjects = sim.copyPasteObjects({box,boxDummy},0)
My task is done, the script does exactly what I want it to do but, the initial box I created is there on the floor. Is there a way to hide it or make it invisible?

coppelia
Posts: 8975
Joined: 14 Dec 2012, 00:25

### Re: How to hide a dummy and cuboid grouped with it

Hello,

why do you use a dummy and a cuboid instead of a cuboid alone?

To make a shape invisible to the rest of the simulation, you need to do following:
Then, once you have copied the object, appropriately adjust its properties, e.g.

Code: Select all

copy=sim.copyPasteObjects({cuboid},0)[1]
-- make it visible:
sim.setObjectInt32Param(copy,sim.objintparam_visibility_layer,255)
-- make it collidable, measurable and detectable:
sim.setObjectSpecialProperty(copy,sim.objectspecialproperty_collidable|sim.objectspecialproperty_measurable|sim.objectspecialproperty_detectable_all)
-- make it respondable and dynamic:
sim.setObjectInt32Param(copy,sim.shapeintparam_respondable,1)
sim.setObjectInt32Param(copy,sim.shapeintparam_static,0)
If you tag your cuboid as model base, then you can enable/disable above properties in the model dialog. Then, programmatically, you can simply do:

Code: Select all

copy=sim.copyPasteObjects({cuboid},1)[1]
sim.setModelProperty(copy,0)
i.e. you would simply remove all model override properties.

Cheers