Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
-1
Question by Carbongrip · Oct 31, 2013 at 06:43 AM · c#weaponspaceship

Space Torpedo

What would be the best way to go about making a space torpedo like in trek films? I would also think there's some kind of orb effect built in to unity that I can use? Any who I am all ears… any help is great, even documentation is fine. Been using C# as its like c++.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by xt-xylophone · Nov 01, 2013 at 12:57 AM

You havn't given much on what features you want but ill tell you some structure to aim for to get started.

First make an empty gameobject, called Torpedo or w/e you want. Put its coordinates and rotation all to ZERO so you can orient it correctly.

Now create the effects you want, look at some tutorials on particles or models and put it as the child of the blank gameobject. This means the graphic and the object itself are separate and become much easier to change. Make sure this is at zero too. Also make sure its facing the Z axis because in your script you'll probably use transform.forward to make movement and forward is the Z axis.

Add a script to the parent object called Torpedo (once again w/e you want). The simplest kind of torpedo goes straight. So make a public float variable called speed. In the Update function do something like this:

 transform.Translate(transform.forward * Time.deltaTime * speed);

This means the torpedo will move forward at speed/second. Since it was public you can edit in the Unity editor now :) If you want more advanced movement, edit how it moves here!

Drag this object into the folders window and it becomes a prefab. Look up how the Instantiate function works and in another script use that to create the missile at the point you want. Once its made it will fly straight at that speed.

But this will just go through walls and stuff. Add a collider to the parent, make a close shape to what you need, simpler the better then look up OnCollisionEnter(http://docs.unity3d.com/Documentation/ScriptReference/Collider.OnCollisionEnter.html)

This function gets called when the collider hits stuff so do whatever you need in that function, maybe checks to see what it hit and do accordingly.

This is the most basic way to make a torpedo/missile/bullet I can think of. Try this and play around, you'll pick up and understand what you need to do next to make something cool :)

Good luck!

Comment
Add comment · Show 3 · 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 xt-xylophone · Nov 05, 2013 at 04:07 AM 0
Share

That was pretty much a guideline on what to do when you already know how to use Unity. Im guessing you're pretty new? Thats cool but you havn't given much info on what you actually want. Just a torpedo? Want it to move? Just the graphic? What created the torpedo? Theres a thousand more questions I can ask so you need to be more specific. Id recommend doing some basic scripting tutorials and once you've done them reread my post and you should have an idea of what you should do to do whatever you want.

avatar image Carbongrip · Nov 05, 2013 at 05:10 AM 0
Share

Well you are right very new but I have experience in c++ so c# is no big deal just the unity specific code is challenging but I think I got it covered. I am looking to make a empty object attached to my ship that launches a torpedo at the selected target(have existing script that does that from my beam weapon) it hits the enemy ship and causes damage then disappears. How to make graphic is big concern in the process, I have only worked will models in unity not particles and stuff. I will most likely make a gui button that launches the torpedo.The link shows an idea of what it looks like… behind the green ship is the torpedo flying at ship Click here

avatar image xt-xylophone · Nov 05, 2013 at 07:32 PM 0
Share

Ah I see so you're getting quite far into it :D

For the torpedo they look like a very bright light with a short trail. What you could do:

  • Have empty Gameobject as the root of the torpedo

  • Add a box/sphere collider to it to the right size

  • $$anonymous$$ake 2 fire prefabs(The basic one that comes in the standard assets package) and add them as the child of the torpedo.

  • Find the checkbox for world/local space and check it for ONE of them. This means that one will make a trail as it moves and the other will just form a ball since it render in its own local space.

  • Edit all the values to get a feel for what they do until you have the desired look.

  • $$anonymous$$aybe add a light source component to the parent, maybe even with a lense flare on it.

Play around with it, theres a couple tuts on particles so im sure you could make something look pretty cool!

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.

Follow this Question

Answers Answers and Comments

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Rotation Speed 1 Answer

Distribute terrain in zones 3 Answers

Multiple Weapon System Implementation. 1 Answer

Pick all gameobject with specific tag 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