How to detect released key

Typically: "How do I... ", "How can I... " questions
Post Reply
nex
Posts: 28
Joined: 07 Nov 2016, 15:48

How to detect released key

Post by nex » 29 Sep 2019, 08:59

Hi,

I saw there is the sim.message_keypress constant. But how do I detect when a key is down and when it is released again?

I'd like to drive a car over the keyboard, turning left when the key is down, and turning back to the center direction/0°when releasing it.

coppelia
Site Admin
Posts: 7441
Joined: 14 Dec 2012, 00:25

Re: How to detect released key

Post by coppelia » 01 Oct 2019, 05:39

Hello,

you can't (yet) directly detect a key release. You'll have to wait a few ms, if the key is not repeating, then you could consider this as a key release.

Cheers

Post Reply