This is where active bugs can be seen and where to post a new bug.

Input override by player

Input override by player

Postby SpiderMack » 16 Nov 2017, 12:03

Hi,

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 ?
User avatar
SpiderMack
Skyline Expert
 
Posts: 441
Joined: 02 Dec 2016, 09:15
Skill: Concept artist
Skill: 3D Modeller
Skill: Level Designer
Skill: Scripter

Re: Input override by player

Postby SolarPortal » 16 Nov 2017, 12:46

not sure, it should be fine.

have you tried using the onKeyDown and onKeyUp functions?
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer


Return to Active / New Bugs

Who is online

Users browsing this forum: No registered users and 2 guests

cron