I am trying to toggle the visibility of a sail on my skiff during the session with a boolean flag, but without any luck. Here are the relevant bits of my code:
In clbk_setclasscaps I have a loaded mesh with handle hmesh and identify the mesh groups for the sail:
I am toggling with a boolean sail_up. When true, the sail should be visible, when false, it should be invisible.
I have tried the following code in both clbk_prestep and clbk_visualcreated, but to no avail:
I initialize the boolean, and the mesh will either be visible or invisible at the start of the simulation based on that initial status, but it won't toggle during the session when I change that boolean. I'm honestly just pattern matching code @Gondos pointed to me to that makes the passengers appear/disappear in the DG, but I'm not wholly understanding what I am missing.
In clbk_setclasscaps I have a loaded mesh with handle hmesh and identify the mesh groups for the sail:
Code:
sail_meshgroup = {14,15}
I am toggling with a boolean sail_up. When true, the sail should be visible, when false, it should be invisible.
I have tried the following code in both clbk_prestep and clbk_visualcreated, but to no avail:
Code:
--set sail
for i = 1, #sail_meshgroup do
ges = {}
if sail_up == true then
ges.flags = GRPEDIT.SETUSERFLAG
ges.UsrFlag = 3
elseif sail_up == false then
ges.flags = GRPEDIT.SETUSERFLAG
ges.UsrFlag = 1
end
oapi.edit_meshgroup(hmesh, sail_meshgroup[i], ges)
end
end
I initialize the boolean, and the mesh will either be visible or invisible at the start of the simulation based on that initial status, but it won't toggle during the session when I change that boolean. I'm honestly just pattern matching code @Gondos pointed to me to that makes the passengers appear/disappear in the DG, but I'm not wholly understanding what I am missing.

