I made moving a kinematic physic object with this code.
- Code: Select all
obj = 0;
pBodyID =0 ;
x = 0;
y = 0;
z = 0;
-- System initialisation - Skyline script entry point
function onInit(objID)
obj = objID;
x,y,z = entity.getPosition(obj);
end
-- Called after all the scenes onInit() have been called.If you need to ensure your data exits, then do you set up here
function postInit()
end
-- Updated every frame
function onUpdate(timeDelta)
if(input.keyDown("a") == 1)then
z=z+0.3*timeDelta;
end
if(input.keyDown("s") == 1)then
z=z-0.3*timeDelta;
end
if(input.keyDown("q") == 1)then
x=x+0.3*timeDelta;
end
if(input.keyDown("d") == 1)then
x=x-0.3*timeDelta;
end
pBodyID = physics.getBodyID(obj);
physics.move(pBodyID, x, y, z);
end
The bug is using the same input keys as the player object is using , the input is not send to the kinematic object to move.
If i change code input with keys not used by the player controller, it works.
Is this normal ?