No collision detection after creating TSStatic object

Discussion in 'Programming' started by Riccarr, Oct 2, 2024.

  1. Riccarr

    Riccarr
    Expand Collapse

    Joined:
    Jul 28, 2024
    Messages:
    41
    Hi ... I'm trying to create a TSStatic object with collision detection in my mods lua code.

    I can create the object and apply shapeName and the object properly displays, however it does not have collision detection.

    myObject = createObject('TSStatic')
    myObject:setField('shapeName', 0, "resources/shapes/" .. progressImage .. ".dae")
    myObject:setField('collisionType', 0, "Visible Mesh")
    myObject:registerObject("myObjectName")
    myObject.postApply()

    If after the object is created and I enter F11 world editor and just click object and reload the image for it and F11 to exit, then the object has collision. Seems there is some missing magic "reload collision" call I am missing. I thought postApply() would be it, but that doesn't seem to work.
     
    #1 Riccarr, Oct 2, 2024
    Last edited: Oct 2, 2024
  2. DaddelZeit

    DaddelZeit
    Expand Collapse

    Joined:
    Jul 17, 2019
    Messages:
    3,504
    The function you're looking for is this:
    Code:
    be:reloadCollision()
     
  3. Riccarr

    Riccarr
    Expand Collapse

    Joined:
    Jul 28, 2024
    Messages:
    41
    Hey thanks a bunch! That was the magic call, it works.
     
  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