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 /
avatar image
0
Question by 3dDude · Feb 25, 2010 at 02:40 AM · colliderfpsbullets

colliding bullets

hi i need help with colliding bullets when i set the speed to be to big they don't collide with the wall please help

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

2 Replies

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

Answer by Sebas · Feb 25, 2010 at 03:37 AM

The problem might be that through the high velocity of your bullet, the fixed frames in which your application is running are not enough to register your collision with the wall. In one fixed frame the bullet is in front of the wall and during the next fixed frame, the bullet already went straight through the wall. Everything that happens in between has no consequence for registering a collision.

One approach to avoid this problem is to use a raycast and build your logic of hitting the wall with the bullet on whether and where the raycast hit your wall.

There is one script on the Wiki which might of of help.

There is also some discussion about this issue in this forum thread. However, I believe just increasing collider size is not an ideal solution, because you will eventually be running into problems (literally!) when characters or other objects collide with your wall even though they are still at a distance to the actual rendered wall.

edit: A working example of a script for firing a bullet and using a raycast can be found in this forum thread.

Comment
Add comment · Show 10 · 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 3dDude · Feb 25, 2010 at 02:15 PM 0
Share

the one in the fps tutorial just uses a raycast and no bullets i tried that but it did not look good

avatar image 3dDude · Feb 25, 2010 at 02:25 PM 0
Share

on the script Wiki is all that stuff really needed for colliding bullets

avatar image Sebas · Feb 25, 2010 at 08:34 PM 0
Share

I personally haven't used the wiki script yet, but from looking at it, it seems this is required for not "missing" your wall with the bullet.

avatar image 3dDude · Feb 26, 2010 at 03:37 PM 0
Share

can you just say

var hit : RaycastHit; if(Physics.Raycast(transform.position,transform.TransformDerection(Vector3.forward,hit){ Destroy(gameObject); Instantiate(sparkPrefab,transform.position,transform.rotation); }

avatar image Sebas · Feb 27, 2010 at 05:52 PM 0
Share

correct some syntax like a missing ) for your if statement and "TransformDirection" and try. I can't test anything since I am out of town for a few weeks. Sorry

Show more comments
avatar image
0

Answer by Ashkan_gc · Feb 25, 2010 at 05:10 AM

you can increase the number of fixedUpdates. go to edit/project settings/physics and reduce the value of fixed delta time. this will have a performance penalty for you but you'll have more FixedUpdates so the collision will be registered. the best approach is to use raycasts as sebas said. unity checks for collisions in FixedUpdate and in your application the collision can not be registered because the velocity is too high and in a FixedUpdate the bullet is in one side of the wall and in the next FixedUpdate it is in another side. increasing the number of fixedUpdates can help but you can make sure to have all collisions registered with raycasts.

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

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

No one has followed this question yet.

Related Questions

why Collider in tree Makes low fps 1 Answer

Terrain with lots of objects 1 Answer

Why would my floor suddenly disappear upon play? 1 Answer

bullets flying through enemy 1 Answer

FPS controller to not interact with certain colliders? 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