Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Can crosshair vehicle with mouse????? (http://www.alice.org/community/showthread.php?t=7528)

waqar 11-08-2011 01:01 AM

Can crosshair vehicle with mouse?????
 
Hi guys I am making a shooting game for that i am thinking to make a crosshair bt dont know how to vehicle it with mouse can anyone help me plz

Thanks in advance

Regards
Waqar Muhammad

zero00 11-08-2011 04:09 PM

You can't parent something to the mouse as far as I can tell, but it is possible to move something roughly to where the mouse cursor is, though.

I did an experiment with this before. Perhaps [URL="http://www.alice.org/community/showthread.php?p=38326#post38326"][B]this[/B][/URL] may help :D
(Download the one called "mousecursor_test3_optimal")

waqar 11-08-2011 10:04 PM

Ty for helping me hope i can get something from it which is helpful for me and one more thing if u can tell me about that axis thing how what is the axis game in alice x , y , z axis waiting for ur reply and ty again

zero00 11-08-2011 11:15 PM

Here's how the world works (as best as I can explain it)
 
I'll explain how my mouse cursor system works

-(Make sure the screen has no black bars on the sides. The bars mess up the program. You can get rid of the bars, by resizing the world window and opening and closing it until the bars are gone.)

-When you click on the little dot in the center, it saves mouse cursor's distance from the top and left edges of the screen. Since the dot is in the center, you get roughly half the distances from the left and top edges of the screen. These values are saved as "x_middle" and "y_middle"

-If the "mouse cursor's distance from the left edge of the screen > 0" and less than "x_middle x 2" (the same applies for the top edge), a dummy object moves to where the mouse cursor is, (using some strange math I can't remember or fully explain :p Go to the updateCursor method to see the math) then the crosshair object moves to the dummy's position.

There may be other less complicated ways of doing this, but this is the way I came up with. Hope this explains it :D

(The updateCursor method really is only a few lines long, but the math was a bit hard. Also, the "move to" method's offset by parameter can be very useful! If you don't know what the "offset by" parameter does, [URL="http://www.alice.org/community/showthread.php?t=1975&highlight=quaternion"][B]this thread[/B][/URL] will explain it somewhere. :p)

waqar 11-09-2011 12:29 PM

How u make that crosshair obj and how it appeast when we click on that red dot?:confused:

zero00 11-09-2011 04:13 PM

[QUOTE=waqar;43256]How u make that crosshair obj...[/QUOTE]I made a crosshair texture and put it on a square.
[QUOTE=waqar;43256]...and how it appeast when we click on that red dot?:confused:[/QUOTE]The crosshair has a property called "IsShowing" which is false when the world starts. If its false, the object is not visible in the game world at all.
When you click on the dot, the property is set to "true" and the crosshair becomes visible.

waqar 11-09-2011 09:52 PM

ah havnt noticed that it sets on false was looking for opacity but really very thank you i hope i m able to make it again with ur that kind of help thank u again:):cool:


All times are GMT -5. The time now is 03:30 AM.

Copyright ©2021, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.