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 /
This question was closed Aug 17, 2013 at 06:50 PM by Drshk7 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Drshk7 · Aug 02, 2013 at 12:12 AM · rigidbodyaddforcegunrangepower

Real gun range and rigidbody.addforce power?

Hello! I want to make my FPS game as accuratly as possible. How can I make the rigidbody.addforce so that it would be like a real gun? Like how what should I make the addforce integer to be in order to make it have a range like a pistol? Is there like a scale?

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

  • Sort: 
avatar image
1
Best Answer

Answer by zados · Aug 02, 2013 at 12:37 AM

Generally at this point what you'll want to do is read up a little bit on physics specifically line collisions and bullet momentum based on gun type. I recommend the research because you used the word pistol.. there are a ton of pistols out there.. a 9mm berreta will not be as powerful as a 357 magnum and a desert eagle will be more powerful than that.

There 2 ways you can do this.. you can write your own physics (not recommended, but most accurate) or use the built in engine and give it a look and feel on how you want it just by eyeing everything.

What I would do is attach a rigid body to my bullet check the use gravity box and set a velocity for the object. You can technically use add force but you might get unintended results such as a bullet hitting a wall or a person could technically move it as the force would transfer. where on a velocity you can just set the velocity to 0 once it hits.. then set a timer for it to destroy it's self.

Hope this helps you out, 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 Drshk7 · Aug 02, 2013 at 02:16 AM 0
Share

How would I make my own physics? Also, that was a great answer.

avatar image zados · Aug 02, 2013 at 01:49 PM 0
Share

in unity when you make a game object there is a transform on it that lets you set positions. You can use that in conjunction with a mass and force variable to plot the position you would go based on rotation.

Your best solution would to be to go to goolge and look up physics tutorials that specifically work in movement, distance tracking, and collisions.

avatar image rowdyp · Aug 02, 2013 at 02:41 PM 1
Share

well the best way to do a gun is with a raycast... that way there is no "bullet" from the gun, just a line that projects from the gun when the fire button is pressed to a range you set. This way, you also avoid things like bullets going through objects/enemies because they are traveling to fast and pass through the collider ins$$anonymous$$d of colliding with it.

Follow this Question

Answers Answers and Comments

16 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 avatar image

Related Questions

Add force to a rigid body with raycast 1 Answer

How to fire a gun using raycasting and still add force 1 Answer

Why is velocity checking intensive? 0 Answers

How to move a rigidbody along a curve or spiral 0 Answers

AddForce to position on Rigidbody 2 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