How can you make a lua trigger a mesh change?

Discussion in 'Programming' started by CrashHaven, Dec 18, 2023.

  1. CrashHaven

    CrashHaven
    Expand Collapse
    Banned

    Joined:
    Nov 5, 2023
    Messages:
    101
    How do you make a lua trigger that when entered, changes a mesh dae, and when exited it stays like that?
     
  2. SineMatic

    SineMatic
    Expand Collapse

    Joined:
    Nov 17, 2022
    Messages:
    68
    I don't know how to do that, but you can try setting transparency (alpha) to 0 for one mesh and to 1 for another. Here's code (assuming you already set transparency of the second mesh to 0):

    Code:
    local function meshAlpha(data)
       if data.event == 'enter' then
          for i=1, #core_vehicle_manager.getPlayerVehicleData().vdata.flexbodies do
    
             local name = core_vehicle_manager.getPlayerVehicleData().vdata.flexbodies[i]["mesh"]
    
             if string.find(name, "meshName1") then
                be:getPlayerVehicle(0):setMeshAlpha(0, name, false)
             end
         
             if string.find(name, "meshName2") then
                be:getPlayerVehicle(0):setMeshAlpha(1, name, false)
             end
          end
       end
    end
    
    meshAlpha
    Instead of "meshName1" and "meshName2" use your flexbody names
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice