Disappearing/reappearing Objects

Discussion in 'Gameplay' started by MarvoloIII, Oct 13, 2018.

  1. MarvoloIII

    MarvoloIII Boxer

    Joined:
    Oct 2, 2018
    Messages:
    7
    Likes Received:
    0
    Can I make an object in my game appear and disappear, if so how?
     
  2. DanFarfan

    DanFarfan Avid Boxer

    Joined:
    Sep 22, 2018
    Messages:
    101
    Likes Received:
    42
    There are probably multiple answers to this question.

    One way I've used (am using) is to change the position of the object to make it out of view.

    For example:

    let current_pos = this.entity().position();
    let save_pos = new Vec3(current_pos.x, current_pos.y, current_pos.z);
    // not visible
    this.entity().setPosition(current_pos.x, -50, current_pos.z);
    ...
    // visible
    this.entity().setPosition(save_pos.x, save_pos.y, save_pos.z);



    I suppose, depending on your game, the negative value and even the dimension (?) might have to be different.

    @DanFarfan
     
    MarvoloIII likes this.
  3. MarvoloIII

    MarvoloIII Boxer

    Joined:
    Oct 2, 2018
    Messages:
    7
    Likes Received:
    0
     
  4. DanFarfan

    DanFarfan Avid Boxer

    Joined:
    Sep 22, 2018
    Messages:
    101
    Likes Received:
    42
    Oh.. yes. BB3 is the only BB that allows Javascript coding.
     
  5. Josh (Nology Games)

    Josh (Nology Games) Avid Boxer

    Joined:
    Nov 27, 2017
    Messages:
    200
    Likes Received:
    155
    you can use the "Transform" logic piece to do the same thing, and it really is amazing what you can do with "Transform" you can pretty much make an AI with it, I swear I love it so much!!
     
    MarvoloIII likes this.
  6. MarvoloIII

    MarvoloIII Boxer

    Joined:
    Oct 2, 2018
    Messages:
    7
    Likes Received:
    0
    Thanks you so much, I'll try that.
     

Share This Page