Change Character Color Script

Discussion in 'Buildbox 3.0' started by Dario, Dec 4, 2018.

  1. Dario

    Dario Boxer

    Joined:
    Dec 2, 2018
    Messages:
    42
    Likes Received:
    0
    Hello,

    I'm trying to change character color when he colide with object. I set IF COLIDE with chosen affected afect (in my case ChangeColorObject) and connection with script

    let _assetName;

    var _enabled = false;

    let _ent;









    function init(){

    _ent = this.attribute('Asset Name');

    _color = this.attribute('Color RGB');

    }













    function signal(name, value){

    _enabled=value;



    if(_enabled){

    _ent.setColor(_color.x,_color.y,_color.z);

    }

    }

    What I missed?
     
  2. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    141
    To simplify, have you tried just using the Set Color node?

    Also, are you on a PC or a Mac? If PC are you getting any errors in the JS log window?

    "let _ent" should be "var _ent". Probably true of _assetName too, but I don't know how you're using it.
     
    Last edited: Dec 4, 2018
  3. Dario

    Dario Boxer

    Joined:
    Dec 2, 2018
    Messages:
    42
    Likes Received:
    0
    I'm using a Mac. I fix that with Set Color node. Thank you. I'm new on this, but very passionate :)
     

Share This Page