Staredit Network > Forums > SC2 Assistance > Topic: [Solved] Tracking mouse
[Solved] Tracking mouse
This topic is locked. You can no longer write replies here.
Aug 21 2010, 2:38 am
By: payne  

Aug 21 2010, 2:38 am payne Post #1

:payne:

Remember that small SC1 EUD-concept map which was contained within 20x12? It was about stopping waves of enemies running from left to right by passing your mouse over them, no click required or anything.
I was wondering if we could get the same kind of effect on SC2.



None.

Aug 22 2010, 11:20 pm payne Post #2

:payne:

Bump. D:



None.

Aug 22 2010, 11:55 pm Temp Post #3



I don't think anyone has made any progress in doing this, since it is not immediately apparent how we could accomplish this with triggers.



None.

Aug 23 2010, 12:36 am shmeeps Post #4



Well, I think the main problem is again the difference between GUI coordinates and real world coordinates of the mouse position.

The mouse actually moves along a 2D XY plane, which we see as the Graphical User Interface (GUI), which is the mouse, the command cards, the minimap, etc. This is how we control the mouse.

In any 3D RTS game (Or any game with units selectable by mouse, or highlighting people by mousing over them, or... well, you get the idea), the engine must convert between the 2D GUI coordinates of the mouse to the corresponding 3D real-world (in game) coordinates that the mouse is hovering over.

The most common way is ray tracing, as it is probably one of the simplest methods that is also quite efficient. Without going into too much detail, imagine taking a perfectly straight line from the focal point of the camera, running it through the mouse's position, and making it keep going until it hits some object in the game. The first thing that it hits will be the unit selected. If it doesn't hit anything, it wont do anything.

The problem is, even though that ray tracing is quick, running it during every game cycle can become expensive and can lag game play if the engine was not built with this in mind. (A lot of people say, but how do they do this in FPS games, which is actually completely in 3D, so it doesn't actually have to be used quite the same).

Now, SC2 seems to have a relatively quick engine, and I think that it would be very possible using custom scripts, since the mouse position is inheritly tracked (or else it wouldn't work). The problem is finding out how SC2 tracks it, and how we can access that data, or if we can find a way to keep track of it our selves. The second problem is piggy backing on the built-in ray tracing algorithm to get the results we need. Or writing a new one.

TL, DR: I don't see how it is possible with triggers, may be possible with custom scripts, once some progress is made towards understanding them.



None.

Sep 1 2010, 4:59 pm payne Post #5

:payne:

http://forums.sc2mapster.com/resources/tutorials/9857-simulated-structure-placement/#p8
See post #1 if you want a good explanation.

Basically, it's all about using the "Mouse lock" feature, since it locks the mouse at the middle of the screen, thus letting you know it's position ;)

Tag this thread as solved.



None.

Sep 2 2010, 12:34 am Temp Post #6



That is hardly a good solution to tracking mouse movement and has very limited application.



None.

Sep 15 2010, 6:27 am payne Post #7

:payne:

http://www.sc2mapster.com/assets/realtime-mouse-tracking-system/

I had this in mind since the start... to use invisible units to detect the click, but it wouldn't have been very efficient. Well this guy used 'Highlight' instead, which makes much more sense. :P



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[08:08 pm]
anoeth47 -- Can I get a moderator/lord of the forum to clean up my topics - delete posts not really part of the topic.
[07:11 pm]
anoeth47 -- Can you download from forum if not a member?
[07:07 pm]
anoeth47 -- Thank you NudeRaider much cleaner
[04:24 am]
anoeth47 -- Sie_Sayoka >>> Thanks!!! Got the png's to show up in Map Showcase
[2026-4-22. : 10:20 pm]
anoeth47 -- Sweet
[2026-4-22. : 7:48 pm]
NudeRaider -- https://staredit.net/381642/ really makes you appreciate (again) how good sc music is.
[2026-4-18. : 3:57 am]
NudeRaider -- https://staredit.net/381600/ You have 5 minutes, then you can only edit your posts.
[2026-4-17. : 4:05 pm]
NudeRaider -- DarkenedFantasies
DarkenedFantasies shouted: you eat lots of beans
:lol:
Please log in to shout.


Members Online: Vrael, Dem0n