Hi, I'm new to Lua and CoppeliaSim.
I am attempting to change an Objects 'Detectable' Special Property to false (unchecked) in Lua for a specific event. Having the Objects Detectable property change to true from false works with this line:
'sim.setObjectSpecialProperty(objectHandle, sim.objectspecialproperty_detectable)'
However, I can't seem to find a way to do it so it changes it from true to false. Does anybody know how to do this, only through Lua code not through the Interface. I know its a weird request.
Thanks.
How can I make an Object Un-Detectable through LUA
Re: How can I make an Object Un-Detectable through LUA
Object special property value is a bit mask.
To set the detectable flag:
To clear the detectable flag:
Note:
See also: https://www.lua.org/manual/5.3/manual.html#3.4.2
Btw, you can use a value of
To set the detectable flag:
Code: Select all
local oldVal = sim.getObjectSpecialProperty(objectHandle)
sim.setObjectSpecialProperty(objectHandle, oldVal | sim.objectspecialproperty_detectable)
Code: Select all
local oldVal = sim.getObjectSpecialProperty(objectHandle)
sim.setObjectSpecialProperty(objectHandle, oldVal & ~sim.objectspecialproperty_detectable)
&
is bit-wise AND|
is bit-wise OR~
is unary bit-wise NOTSee also: https://www.lua.org/manual/5.3/manual.html#3.4.2
Btw, you can use a value of
0
to indicate none of the bits set:Code: Select all
sim.setObjectSpecialProperty(objectHandle, 0) -- remove all bits
Re: How can I make an Object Un-Detectable through LUA
That worked, Thank you.