Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by weedmastersr · Nov 06, 2015 at 10:38 PM · animationshootingprojectiletargetting

How to make paint characters shoot each other?

Hello everyone,

I'm a total newbie when it comes to Unity. Anyway, I'm doing this game and I've created the terrain and everything but now I need a bit of advice. This is a 3rd person shooter game and my characters are men made of paint. I've used the 3rd person controller and models offered as standard by Unity because they're perfect for the look I'm going for and what I need. But, I want to make these characters shoot each other with projectiles of paint that come out of their bodies. I also want them to color the bodies of their enemies when hitting them, or the terrain if they miss. Can you please give me any advice on how to do this?

I hope I haven't offended you with my stupidity and thanks in advance for any help!

Comment
Add comment · Show 1
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 Statement · Nov 07, 2015 at 12:26 AM 0
Share

I hope I haven't offended you with my stupidity

No. Although for simplicity, it would be preferable if you had thought of your problem as sub-problems and focus on solving one problem at a time. I don't want to write an essay of why, the tl;dr can be summed up as:

  • One small question is likely already asked/answered.

  • One small answer closes question.

To me, it sounds like you are asking three things for example;

  1. How can I shoot a projectile?

  2. How can I detect when the projectile hit something?

  3. How can I apply an effect of paint splash on an object?

The answer to each question can be a multistep answer, and you might not yet even have a clear idea of what you want to happen, how difficult it is, or what alternatives there are. As you can imagine, a "complete answer" for your "complete question" in this form can get verbose, tricky to answer because person A perhaps know about solving step 1 and person B know something about solving step 3. Neither person A or B want to reply, because they know they won't be able to answer the complete question.

1 Reply

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

Answer by Statement · Nov 07, 2015 at 12:42 AM

I'll give you a high level overview of what you can do.

To shoot a projectile, you need a direction to your target and then either move a slow moving object object with a rigidbody/collider in that direction or cast a ray for instant/rapid fire, or a combination of both. To spawn a projectile, either a prefab is instantiated or an object is reused from an object pool for performance reasons. If you use a game object to represent your projectile, then it need to keep moving. You could just add a force to the rigidbody, or write a script that control the path exactly how you want it.

To detect the projectile hit something, typically you'd just query Physics.Raycast for instant/rapid fire type projectiles, to see what object is hit. Or use OnTriggerEnter or OnCollisionEnter for slower moving projectiles, where the projectile handles collision response after it's been fired.

Once an object has been detected, you'd respond to the collision by applying an effect to the object that represents paint. I don't know what specific effect you had in mind, but a simple "to get started with anything" could be to change the color of the objects material. To do this, get the renderer(s) of the object and modify the renderers material color. Obviously it would not look very nice to color the entire terrain but it can be a first step. More accurate solutions use decals. Even more accurate solutions could use shaders to make paint "flow" or "drip" over the bumps and normals of the bump map. For ideas, check out how Overgrowth did blood effects.

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 weedmastersr · Nov 07, 2015 at 07:10 PM 0
Share

Thank you so much! This is really helpful to me. Your help is much appreciated.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

My enemy AI shoots projectile only to certain degrees. Apparently related to transform.position? 0 Answers

How to fire bullets from multiple guns at the same time? 2 Answers

Don't know how to end animation of shooting ! (code) Please help ! 0 Answers

How to access a animation transition paramater bool via script 2 Answers

Shooting animation and bullet generation issue 0 Answers


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