Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I'm trying to make ccbEmulateKey to work with a built-in "Object controlled by keyboard" behavior. Every button work except shift key, which makes character run. It seems like emulation is still working and key event is actually triggered, but it doesn't seem to affect this specific behavior. Demo is here:https://drive.google.com/file/d/... G key turns on shift key emulation - this could be seen in the text output. It also trigger shift "key press" event same as pressing actual shift key on the keyboard, Even though, everything seems to be setup properly, G key doesn't trigger sprint for the character. Does anyone faced this before, did I set it up incorrectly, and if this is an actual issue is there any workaround? I also tried different other approach, like making ccbEmulateKey spam shift with different intervals, use keycodes for left and right shift (160 and 161) - nothing seems to work. |
||||
|
JIC, in his discord said that, he fixed the issue with shift and control key for Emulate key but it will be in next update of Coppercube, the current API automatically emulate "shift" key always, along with every other key. |
||||
|
Thank you for the info. I guess, I'll have to come back to this in a couple of years than. |
||||
|
Yeah, the "shift" key bug was fixed but I think you wanted to eulate shift key with G right? Just in case you don't know Coppercube use some special keycodes for some keys instead of standard Javascript key code. instead of "16" it uses "160" for left shift key and for right shift key it uses "161" as key code. Also for emulating mouse keys You can use 0,1,2 as keycodes. hope this might be helpful to you, and you don't have to wait for next update. |
||||
|
Thank you for the reply - "G" is only for this example. In a real code changed it based on a variable, it looks like: if (!this.isShiftCurrentlyPressed && Math.abs(ccbGetCopperCubeVariable(this.button_sprint)) > this.deadZone) { I also tried both 160 and 161, and it doesn't work with bult-in behavior, even though, if I add an "if key pressed" behavior it's triggered by key emulation. In fact I tried all keycodes from 0 to 255:) None of these trigger sprint for the built-in behavior. |
|