Cannot move entity by script


#1

I done it before my other examples work where i place the entity and move the netity in the same script. But i forgot how todo it, or spomething else is wrong. What i try todo is moveing simple entity that have stored the entity id in array. placeing works fine, removeing works fine. but moving fails. So i made a smaller example that is trying to move some existing entity that other script have placed. Still failing. Im doing possible something wrong, or something is changed.

Not seeing what i do wrong, tried many combinations but no result it dont move the entity.

function mousePressEvent(event) 
{
      print("click");
      var pickRay = Camera.computePickRay(event.x, event.y);
      var intersection = Entities.findRayIntersection(pickRay);
      newModel = intersection.entityID;
      var identify = Entities.identifyEntity(newModel);    
         
      var newProperties = {
            position: { x: 2973,
                        y: 4990,
                        z: 4310 },
        };
        
        Entities.editEntity(newModel, newProperties);
       
        //print(JSON.stringify(Entities.getEntityProperties(newModel)));
}

Controller.mousePressEvent.connect(mousePressEvent);    

#2

Do you have anything in the log?


#3

@Atlante45

The script is fine, i have it working. so i did not do it really wrong.
I think i just found also the problem… (always happens after you asking for help :open_mouth: ) It looks like the lock is not implemented how i expected. lock means its locked for everybody.

I just double checked it with my other script.
If lock is enabled. It also blocks movement by script, is this a bug ? or missing implementation.

Note, the script that place the entity wants to move it to. but i wanted to lock the object so others cannot move it. That seems impossible right now.


#4

No, I’m pretty sure it’s wanted behavior. If the entity is locked, then nothing can change its properties.


#5

@Atlante45 Yes your right, if lock=true then its not logic if some script can move it or do anything with it. Its secondlife that sneaked in mind and confused things.