## Unset object property

Typically: "How do I... ", "How can I... " questions
makbut
Posts: 10
Joined: 29 Dec 2016, 11:39

### Unset object property

Hello,

I have created a scene in vrep but I want programmatically to set and unset the scene objects' properties.
Specifically, I want to set the object property to be detectable by laser scanner, so I use the "simSetObjectSpecialProperty" command alongside the "sim_objectspecialproperty_detectable_laser" flag, but after a while I would like the object to not be detectable by the laser, but how can I unset the property?

It is that the scene is big, so if all the objects are detectable, everything is getting really slow, so I try to make detectable only the objects that are around my robot.

makbut
Posts: 10
Joined: 29 Dec 2016, 11:39

### Re: Unset object property

Update:
I think I found it.

I just use the command simSetObjectSpecialProperty(objectHandle,0) and it works. Whatever property I set before now is unset. However I am not sure if it is a right way to do stuff.

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

### Re: Unset object property

Hello,

if you want to set property sim_objectspecialproperty_detectable_laser for instance, then you should do:

Code: Select all

local p=simGetObjectSpecialProperty(objHandle)
p=simBoolOr32(p,sim_objectspecialproperty_detectable_laser)
simSetObjectSpecialProperty(objHandle,p)
to clear it:

Code: Select all

local p=simGetObjectSpecialProperty(objHandle)
p=simBoolOr32(p,sim_objectspecialproperty_detectable_laser)-sim_objectspecialproperty_detectable_laser
simSetObjectSpecialProperty(objHandle,p)
But it should not make a difference speed-wise: V-REP will do a 2-pass check, where the first pass is very fast and coarse.

Cheers

makbut
Posts: 10
Joined: 29 Dec 2016, 11:39

### Re: Unset object property

Yes, that seems like the right way!