|
Hello Guys, I'm working on an First Person Shooter and I was searching how to make a smart crosshair and I didn't found anything, I explain (what is my definition of smart crosshair) :
And it is basically this. I finally want how you can make it : with a script, raycast... And maybe some explanation or the final script (if is the good way to make it). Best Regards,
(comments are locked)
|
|
A basic crosshair that spreads. I spend a little bit of time on this and I managed to create the script above. The script is rather basic and there is a lot that you can do with it, but I guess it will do, for now at least. Hello, First Thank You. Second, I tweak a bit with your script and it's really good to make the crosshair. Now do you have any idea to make it focus ? To make it bigger for when it shoot I think about a function that basically said : Add 10 to spread, but I'm not sure if it will be smooth so...
Jan 15 '12 at 09:52 PM
NhommeBeurreOne
I don't really get what you mean by "focus". Do you mean aim down sights or not? I edited the example to spread when you hold down right mouse button. Rather basic example, but it will get you going.
Jan 16 '12 at 08:20 AM
OrangeLightning
Focus : If the crosshair focus on an object that is close he'll be small and, if he's focus on an object that is far he's gonna be a bit bigger.
Jan 16 '12 at 09:56 PM
NhommeBeurreOne
You will have to measure distance between the player and the object he or she is aiming at. Use raycast to retrieve information and use Vector3.distance to measure distance between you and the object.
Jan 16 '12 at 10:11 PM
OrangeLightning
It worked. Thanks for the help. I'm not sure if it'll help at all, but I'll post the conversion here for others to look at. As I said before, it's an extremely straightforward conversion.
Apr 20 at 06:33 PM
Rxanadu
(comments are locked)
|
|
Here is my solution for your question: 1. use Screen.showCusor = false to hide mouseCousor 2. use GUI.DrawTexture for your crossHair 3. if shoote, replace one bigger texture when press fire button,you can adjust the size by GUI.DrawTexture function. 4. use Raycast to gernerate one ray from fire position and if it is hit something with tag,for example "Enemy", replace the texture that belongs to "Enemy"(you need assign tag "Enemy" to your Enemy object.) Thank You for your answer, but I already figure it out. My problem is really when he shoot and he focus. Is your technique is good when he shooting (smooth).
Jan 14 '12 at 01:32 PM
NhommeBeurreOne
(comments are locked)
|
|
i dont know how to make that kind of crosshairs but what you can do is add the cross hairs in the game there is a crosshairs script in the game and the texture is the aim one i hope that helps In the Standard Asset ?
Jan 17 '12 at 01:36 AM
NhommeBeurreOne
Alright here is what you have to do first make a gameobject and name GUI then search Crosshairs in the bar with everything in unity not your game then when you find that drag it into your GUI gameobject click on you gameobject and you will see the crosshair script with a texture that is not there in the texture folder you will see the aim one then drag that into the crosshairs script and you are done if you have any questions just ask i will help i look at my email almost everyday to see if there is a new comment
Jan 17 '12 at 09:04 PM
skully42
(comments are locked)
|

Any idea , please ?
Answering your own question like this won't help. If you want to 'bump' just edit your question a little and save
Take this in note
I'm also looking for a Smart Crosshair for my FPS game. And i have seen that Dastarly Banana has a good one. But only the system how he makes that is to difficult. Don't understand it
... Then work on simpler things, until you reach the level at which you do understand it.