x


crosshair help needed

hello everyone

i have a cross hair in my third person shooter game and it moves around with my mouse. so basically where ever my mouse is that's where the cross hair is as well. I need help making it so that my bullets that my character fires land within the cross hair that i have. i also want my player to turn to face which ever direction the cross hair is facing because it can spin in a 360 degree angle. any help will be really appreciated. i have little experience with scripting so please try to help me.

thanks in advance

more ▼

asked Jun 21 '10 at 04:48 AM

Joey gravatar image

Joey
42 10 13 15

Please be aware that we aren't going to give you a script that you can just plug into your game and it'll "just work". Unity requires pretty solid programming skills if you want to make games, so you should look under the Scripting section of this page to begin learning how: http://answers.unity3d.com/questions/4897/how-can-i-start-learning-unity-fast

Jun 21 '10 at 06:02 AM qJake
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Having done these 3rd person crosshairs before, the way to do it is to shoot a ray from the camera through your crosshair (I take it that its at the center of the screen - and thus the camera ray would automagically go through it) - and then see where your crosshair collides with geometry.

You then use THAT position to point your character and his gun towards.

more ▼

answered Jun 21 '10 at 10:08 AM

Thomas Hentschel Lund gravatar image

Thomas Hentschel Lund
329 3 4 14

(comments are locked)
10|3000 characters needed characters left

there is a complete in depth FPS tutorial in unity's website. basically you can use mouse look script of standard assets and always draw a crosshair in center of the screen.

more ▼

answered Jun 21 '10 at 07:09 AM

Ashkan_gc gravatar image

Ashkan_gc
9.3k 33 56 120

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1198
x285
x111
x104

asked: Jun 21 '10 at 04:48 AM

Seen: 2325 times

Last Updated: Jun 21 '10 at 04:48 AM