Unset object property

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

Unset object property

Post by makbut » 13 Feb 2017, 12:21

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

Post by makbut » 13 Feb 2017, 13:40

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
Site Admin
Posts: 7441
Joined: 14 Dec 2012, 00:25

Re: Unset object property

Post by coppelia » 14 Feb 2017, 20:15

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

Post by makbut » 15 Feb 2017, 10:31

Yes, that seems like the right way!
Thanks for the answer!

Post Reply