Script in entity stops working (seems to happen when entity is to close to other)


#1

I try to create a working chair. The default scripts from forum not work.
So i created a basic script where enterEntity works.

I copied the script to other entity in front of the chair.
Now i wanted to parent it to the chair for more testing. But i think to avoid problems i copy the chair and delete the old one. The result is the enterEntity in one object stopped responding and it’s just as dead as every other chair i break.

And breaking a chair is pretty easy, just copy it is already enough.

  • Restarted the domain, no luck.
  • Reload cahce, then the problem appears that entities keep invisible.
  • Now my F camera mode in edit.js is doing weird (bottom view)
  • Restart viewer
  • Invisible entity is back.
  • Script still not working, deleting entity and copy a new one from a child that have a working script.
  • Now it’s working, but for how long ?

Not sure what happens.

Moved the entity to put it on the rigth place. also moved it a bit down. and the script is broken again ! @caitlyn, i did hear you where looking into this to ?

ADD: Important info.

It seems the enterEntity command stops working if there’;s other entity to close to the entity that contains the script with enterEntity. I have for now only done the test on the Y axis. As soon i move the cube fiurther away from floor entity it starts working again.


Is the sit script ready for placing in other chairs
#2

Ok more info. This is the script i did put in one entity. When your walk in the entity it’s printing in the log “print(“enter Entity”);” If you place another entity close to it. around +/- 0.5 meters. the this.enterEntity = function(entityID) seems not be called anymore.

(function()
{
    var Ent;    
    var parentID;
    
    this.preload=function(entityID)
    { 
        Ent = entityID;
        parentID = Entities.getEntityProperties(Ent, ['parentID']).parentID;
        print("Parent EntID  "+parentID);        
    }    

    this.enterEntity = function(entityID) 
    {        
        print("enter Entity");
        Entities.callEntityMethod(parentID, 'maybeSit');
    };

})
  • Put the above script in entity that is big enough to walk in (0.5 meters)
  • Put another entity next to it. say 2 meters away from the firts one
  • Walk inside the first entity and look at the log for the text enter Entity. if that is not working check if there’s not other entity to close <1 meter to the scripted one.
  • If it works move the second entity close to the firts scripted one. and walk inside it. no enter Entity anymore.