Download

mouse world location problem

I am trying to make a rts with a selection box system. Well my problem without explaining all my idea for that system is : i use Get Hit Result Under Cursor by Channel then break hit result and break the vector of location to get x and y (real world location of the cursor) after some tests i discovered that there is a jump in x and y values when z change(when cursor hover a static mesh or a blocking volume after hovering ground) i dont understand why that happens… but that ruin the rest of my idea:(…
btw:I am using a my own perspective top down camera …
Can anyone explain to me what “Get Hit Result Under Cursor by Channel” is really doing?Why this jump in the values happen when z change?
whats the solution?
and thank you…:slight_smile:

I’m not entirely sure but I don’t think that its the cursors world location you get by breaking that hit result,
what you will get (what I believe you will get) is the location of the actual hit position.

Edit: There is a “Get Mouse Position” which will return the screenspace position of the mouse but there is also a
“Convert Mouse Location to World Space” node, hopefully those nodes will help :slight_smile:

doesnt the get mouse position only give you the x and y axis of the screen? at least in my understanding?

Ehm, I believe thats what I explained :stuck_out_tongue: , also that there is a “Convert Mouse Location to World Space” node

Sorry for answering much later …
There is a problem when i used “get world location” vector for a actor it did not match “Convert Mouse Location to World Space” location vector when mouse is on top of the actor

since you are using a perspective camera, where your mouse cursor hits, does not necessary be where the actor’s pivot locates(decided by the [ROOT] component’s transform pivot).

Yes but i am doing this for a little sphere so normally it should work…
Also when i move the camera the “Convert Mouse Location to World Space” location vector make a lot more change in the axes then moving the mouse.
Anyone got an other solution to solve my initial problem ?

maybe a screenshot to elaborate? Like put a ground with some fixed unit(say 100^3) cubes on it, and then show what exactly is off.

(Note i use capture tool from win7 so cant capture mouse with it)
Didnt understand exactly what you said but:
If you speaking about convert mouse location problem here : (mouse is on top of the sphere while it is printing the the mouse location and world location for sphere)
b0a50860e7427eb357b74dc4a0409a5ffbc69d9e.jpeg
If you speaking about the first problem with hit location: ( you can see how the vector change after that i moved a bitttttttt the cursor from floor to the cube)
7513b41ff7eafba1af964863f7aa223d1c1c0971.jpeg