How to use the API to set model visible

Typically: "How do I... ", "How can I... " questions
Post Reply
wozxfdha
Posts: 51
Joined: 10 Jun 2021, 09:40

How to use the API to set model visible

Post by wozxfdha »

Hi,

I know we can use

Code: Select all

sim.setModelProperty(objectHandle, sim.modelproperty_not_visible)
to make a model invisible. But is there any way to use the API to set it visible? I did not see the corresponding property.

Thanks.

fferri
Posts: 1238
Joined: 09 Sep 2013, 19:28

Re: How to use the API to set model visible

Post by fferri »

You need to clear that bit using bitwise operations:

Code: Select all

-- show the model
local oldProp=sim.getModelProperty(handle)
sim.setModelProperty(handle,oldProp&~sim.modelproperty_not_visible)
Similarly, to make it not visible, without affecting the other model property bits, you would do:

Code: Select all

-- hide the model
local oldProp=sim.getModelProperty(handle)
sim.setModelProperty(handle,oldProp|sim.modelproperty_not_visible)

Post Reply