Armory: Set Cursor Sensibility X/Y and Set Cursor Position nodes

Created on 9 Jul 2020  路  13Comments  路  Source: armory3d/armory

Set Cursor Sensibility can be used to slow down the cursor when it is over some button, acting like an assist for consoles or games for kids

Set Cursor Position can be used in tutorials for example

feature request kha logic nodes

All 13 comments

what is the problem with multiplying the mouse movement by another vector, and changing this vector as the user sees fit? This would represent mouse sensibility.

There is not a way in logic nodes to change the cursor speed. We can change the values given by the mouse movement and apply it into a second cursor made in game, but it don't affect the cursor properly unfortunately. I think a second cursor is not a good thing, because it will not affect Canvas elements for example (it will not have functionality and with the different sensibility it will not work). Also it will be a thing that future users will need.

I don't think that Kha allows to change the speed of the system cursor, maybe open an issue there?

I think that there is not a way to control the cursor speed properly like an OS do, because the OS is already doing that always. Maybe if we can set the cursor position in the screen, like Set Mouse Lock node do, is possible to "control" the cursor by some math and redefining its position. I don't know about Kha, maybe it's not a feature for it. What do you think, @MoritzBrueckner ?

I'm not even sure if that's possible in Kha^^ You can lock the mouse, but I don't know of a method to set the position.

(Armory can't even lock the mouse cursor in Browser, you have to do some __untyped_js__ black magic to do that)

(Armory can't even lock the mouse cursor in Browser, you have to do some __untyped_js__ black magic to do that)

@Simonrazer Are you sure about that? I tested it with Firefox and it works just fine. Also I looked into the Kha sources and it looks like its implemented for the html5 target. Setting the position on the other hand is problematic and not supported in javascript as that would be a security issue (the cursor could be moved to something else while clicking).

Away3D/Papervision used to have virtual cursors, I think it was my idea to grab the render x and y in the as2 version for this and then someone implemented virtual mouse.

You can implement your own cursor icon and draw it over the top of everything else, normally movement can just by something like var v_current = v_new - ( v_new - v_old )/4; so when mouse is clicked you take the virtual mouse position.

Obviously this is as3 code in papervision.
http://homepages.gold.ac.uk/jonpugh/org/papervision3d/core/utils/InteractiveSceneManager.as

But it may give you some ideas, you can do tricks like allow mouse to appear to move on a table top in 3D, by using simple z maths to scale the cursor ( so steal the uniform projection matrix passed to the shader ). You can also detect which surface is hit and use the UV position, take a look at the source code for Armory paint it will be doing this. Effectively instead of rendering a pixel in the shader you are doing similar with the mouse position in cpu.
Dirty trick include rendering colored texture getting the hitTest on the color value but you don't render the image to screen.

Html5 allows you to hide cursor.

style.cursor = "none";

I am not currently using Armory3D but should be feasible to implement yourself, certainly I could get this working in Iron, but would take time.

@MoritzBrueckner #1566 already exists, need to check if the problem is still there but I definitely had to use __untyped_js__ stuff to get FPS controllers working well in Browser

This makes sense, @nanjizal . A virtual cursor in Canvas can be the best way to go, because there is easier to animate, change its texture and sensitivity. The possibility to use the cursor as any other Element is that we can parent extra texture to it, for example, to make a "loading" next to the mouse cursor instead of changing its own texture everytime.

I think Armory would have its own virtual cursor, but i don't know about the possibility of Canvas listening a virtual cursor.

The problem with virtual cursors is that they lag a frame or two behind the OS cursor(depending on the target or if the game is in exclusive fullscreen). For most games this is acceptable but it can be really annoying. Robert (the Kha dev) explained it here: http://forum.kode.tech/topic/335/how-to-get-rid-of-mouse-position-lag

Thanks for the info, @MoritzBrueckner .

I din't even thought that player already have the mouse sensibility configured for his need in OS and games that are click based and OS interface elements are basically the same thing.

If the sensitivity change is not possible trough Kha, i think that the @Simonrazer method is sufficient at least for the normal use.

I will leave this feature request open just because it can be used for click assists, mainly used in consoles. Also i will add a Set Cursor Position for the same purpose.

link to #374

Was this page helpful?
0 / 5 - 0 ratings