• 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
0
Question by Mr Brightside · Nov 12, 2015 at 04:35 PM · shipweapon systemweaponchangingcannoncannonball

Weapon firing and weapon selection mechanism for C# game

Hi i will get straight to the point I'm building a little personal project (i say personal as in its for practice because its actually my first game) and i have done a lot of research for a couple days looking for answers and presets for building a weapon system that fires cannons on a large ship from either the Portside or the Starboard side or even the bow (front of the ship i also have mortars on the main deck). the only thing i can find coming close to what i need is scripts for modern day weaponry and since i don't even understand how to read code all that well if at all, i want to know if anyone out there knows how to either convert the scripts to what i need or help me figure out how to write it myself. any help is greatly appreciated, thank you.

Comment
Add comment · Show 5
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 Cherno · Nov 12, 2015 at 05:05 PM 0
Share

Some tips.

Represent each cannon muzzle as an empty gameobject pointing in the direction the cannonball would fly. Create a simple gameobject with a cannonball mesh (sphere), give it a rigidbody, and make a prefab out of it. When a cannon should fire, instantiate a copy of that prefab and use RigidBody.AddForce to make it fly forward in a nice arc. Use the Unity User $$anonymous$$anual and Scripting API for further information on the required functions and variables. If you also want a muzzle flash, give the muzzle object a meshrenderer or particlesystem with the appropriate graphics. Use a Coroutine in for tformer case to enable the $$anonymous$$eshRenderer for a fraction of a second to simulate the flash. If using a ParticleSystem, use ParticleSystem.Emit to emit a number of particles. The cannonball itself can also be given a TrailRenderer or ParticleSystem for a trail or smoke effect.

avatar image Mr Brightside Cherno · Nov 13, 2015 at 12:33 AM 0
Share

i don't understand, i have the dastardly banana weapons pack but i can't even get that to work and i don't know how to read of write code languages. could you please give a basic example of what you mean ore even a link to a tutorial would help me, i just can't wrap my head around this weapon system. thanks

avatar image ijidau · Nov 13, 2015 at 01:25 AM 1
Share

To be honest, you will struggle to get anywhere unless you start learning to code. The Unity $$anonymous$$m have done a great job of making this as easy as possible. http://unity3d.com/learn/tutorials

They key is to realise that like most things, you'll need to start simple and build your knowledge and experience over time. If you don't understand something, work your way backwards to the simplest aspect you do understand and start tackling it from that point forward.

avatar image Mr Brightside ijidau · Nov 15, 2015 at 01:47 AM 0
Share

i've just tried googling answers and definitions to find out why my scripts are not working even though i write them exactly how it is down in the demonstrations and tutorials (i do replace their objects with my own so its compatible with my project) and still nothing is working for me i even went to the link u sent me for a couple hours watching their tutorial and nothing is working, my scripts don't bring up the options in the inspector where some scripts will have customisation options to place objects and things. what am i doing wrong? why can't i just build what i need and move to the next part?

avatar image Cherno Mr Brightside · Nov 16, 2015 at 01:20 PM 0
Share

As ijidau said, if you don't understand how parts of even all of a script works, then it's pointless to go on. You need to be able to read and understand code, plain and simple. I recommend creating a few sample scripts which have just a few lines of code; one for learning how to clone objects, one for registering input, one to make a Rigidbody move, and so on. If you can get those to work and more importantly, know why, then you can try and combine what you have learned.

0 Replies

· Add your reply
  • Sort: 

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Coding a class swapping system 1 Answer

Area Effect Damage 2 Answers

I need help with attaching/detaching weapons to a character 0 Answers

Coding a class swapping system 0 Answers

Weapon shooting mechanism problem. 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges