• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by Zippface · Apr 14, 2010 at 06:20 PM · topdownmouse-look

How to make a top down shooter game?

Hi! I am making a tank game and I am going to call it "T.Tank". I want the top of the tank to look at my *Cursor*but I cant get it to work!!

This game is for Pc, and my body part is a picture I have made myself, and it works fine. The top picture is also a picture and it looks like a circle with a sylynder attached to it. I want the Top part to look at my cursor Like a tanks canon. I can shoot with it but i cant look with it.

I have all under control exept the top Part... The top part are not going to look up if i put my cursor on it, it is always going to look forward/at the cursor. The tanks top are just goung to rotate to look the cursor.

Can someone help me?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

7 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by straydogstrut · Apr 15, 2010 at 03:56 PM

In answer to the OP, those of you looking at turret rotation may find it useful to look at Martin Schultz's rts community project in the forums: http://forum.unity3d.com/viewtopic.php?t=18802

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
2

Answer by 3dDude · May 30, 2010 at 09:51 PM

ok if you don't have good answer then the code for looking at the mouse is this

function Update ()
var position = Input.mousePosition;
    newposition = Vector3(position.x,position.y,camera.main.transform.position.y-      transform.position.y);
    var lastposition = camera.main.ScreenToWorldPoint(newposition);
    transform.LookAt(lastposition);
}

so i think this would work. hope this helps!

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image v3ry · Oct 27, 2011 at 10:35 PM 0
Share

What would this script be attached to? like say the barrel or weapon?

avatar image
-1

Answer by Zippface · Apr 15, 2010 at 03:15 PM

This game is for Pc, and my body part is a picture I have made myself, and it works fine. The top picture is also a picture and it looks like a circle with a sylynder attached to it. I want the Top part to look at my cursor Like a tanks canon. I can shoot with it but i cant look with it.

I have all under control exept the top Part... The top part are not going to look up if i put my cursor on it, it is always going to look forward/at the cursor. The tanks top are just goung to rotate to look the cursor.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image straydogstrut · Apr 15, 2010 at 04:00 PM 1
Share

Please make edits to your original question, not an answer.

avatar image
-1

Answer by raptor_133 · Apr 15, 2010 at 03:06 AM

Has the same problem. I'm just starting out in Unity and I would love to get a tutorial like this. It would help out allot!

A basic tutorial where the character will turn towards the mouse pointer and walk towards it if a button is pressed. Also having shooting functional would also be a great help. Anything more and you might as well make the game! but basic AI would put the icing on this cake.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image straydogstrut · Apr 15, 2010 at 04:00 PM 1
Share

As has been said, answers are for answers, not further questions. Your question should really have its own thread. If you're looking for basic AI, look at the 3D Platformer and FPS tutorials. For pathfinding, you might also want to look at Angry Ant's Path and Aaron Granberg's A* Pathfinding Project.

avatar image
-2

Answer by Not showing my name · Apr 14, 2010 at 10:48 PM

I have the same Question. Do you have a title screen yet? if so, How did you make it?

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Peter G · Apr 14, 2010 at 11:48 PM 2
Share

This is a different question really. If you want a more detailed answer you should probably search it or post a question, but here's the title screen in nutshell. Create a new scene and add GUI features (if you don't know how to do that see the manual) then use Application.LoadLevel to bring up your next level.

avatar image straydogstrut · Apr 15, 2010 at 04:05 PM 0
Share

Yes, there's enough code snippets in the Unity Docs to get you started. Also, there's a tutorial at http://www.unitylabs.net/tutorials/user-interfaces/unity-game-interfaces which you might find useful, although I haven't been through it myself yet.

  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

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

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Can't use camera.main [SOLVED] 1 Answer

Trouble with controls on top down fixed camera game. 1 Answer

Rotate an OBJECT along Y axis to look at mouse cursor 0 Answers

How to get acceleration in a top-down angle 0 Answers

third person controller and mouse look 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges