- Home /
Creating a raycast for turret
I am trying to figure out how to create a raycast that causes my turret to turn to face a target. I am creating this for a space ship so I am not sure how I go about making sure that it detects a metor or ship that goes though.
Any Help Please.
Unless there are restrictions on rotation, you can just do a transform.LookAt() to get your turret to face a target. The real problem is finding targets and selecting the one you want to shoot at. It is hard to suggest a solution without knowing more about your game. How many targets? Are you pooling targets? Are there items in the scene that block the turret from seeing the target? Do the targets share a tag (or a couple of tags)?
Answer by Julien-Lynge · Mar 04, 2013 at 07:19 AM
Your post (as it appears now) isn't something we can give you a quick answer for, and isn't really appropriate for UnityAnswers. The UnityAnswers philosophy is:
"[Unity Answers] is a place to ask specific questions that have specific answers. The forum is a better place to post discussions and non-technical questions."
It sounds like what you're looking for is Unity training, rather than a specific answer. I would suggest visiting the following training websites to find the one that best helps you move forward. In addition to the sites below, you can always search YouTube, which has a large number of user-created Unity tutorials.
3DBuzz (hover over the Unity dropdown) - http://www.3dbuzz.com/vbforum/sv_home.php
Lynda - https://www.lynda.com/
BurgZergArcade - http://www.burgzergarcade.com/
Unity3DStudent - http://www.unity3dstudent.com/
UnityGems - http://unitygems.com/
CGCookie - http://cgcookie.com/unity/