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 Ozzy89CZ · Jul 01, 2017 at 01:23 PM · collisionontriggerenteroncollisionenter

Collision in fast speed

Hi, i have 2 game objects - bullet and wall. Bullet have scrip with OnTriggerEnter to detect wall, right? But if bullet have speed 500 meters per second, bullet not detect wall. Im discovery the maximum speed to detect wall (1 meter width) - 29 meters per second. If speed is 30 or higher, bullet not detect wall. Any ideas? Thanks all.

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 Okido · Jul 01, 2017 at 01:46 PM 0
Share

If the bullet has a rigidbody, set the collision to continuous to have it better detect collisions on fast moving objects - though I'm not sure that would help you with an object that is that fast.

Is there any particular reason why you couldn't just use a raycast ins$$anonymous$$d of making an actual bullet?

1 Reply

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

Answer by FlaSh-G · Jul 01, 2017 at 01:52 PM

Rigidbodies move according to their current velocity each frame. That movement should not be understood as movement in a realistic physical sense - it rather changes its position, like a teleport. After doing that, a rigidbody checks whether it teleported into another object and if it did, it moves out and sends collision events.

As a result, at high speeds, rigidbodies are well able to teleport from one side of the object to the other without noticing it.

There are two solutions to this. Which one to use depends on the situation.

The first solution is to reconsider using a rigidbody. Especially for bullets, rigidbodies tend to introduce more problems than they solve. Unless we're taking rockets or Super Mario bullets, bullets are better implemented using Raycasts. Raycasts go from one point into one direction and notice when something is in the way. You can chain multiple Raycasts to implement bullet drop. You can put them all in one loop to make the bullet speed "instant" as in "hits as soon as it's shot" or perform one Raycast each FixedUpdate to get bullet flight time. A SphereCast would be an example of a Raycast with a diameter greater than zero.

I recommend this solution because in most cases, when the bullet is fast enough to port through walls, a raycast is better anyway.

The second solution is to add a script to the rigidbody that performs a so called SweepTest every FixedUpdate. A SweepTest technically does what a raycast does, except for the complex collider-based form of a rigidbody (rather than a point or sphere). I recommend not using SweepTests unless Raycasts are definietly no option. SweepTests are pretty slow and not available in 2D physics.

And, to be honest: Which bullet needs to be physically calculated with a complex form?

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

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

Related Questions

Delayed Collisions Bug (includes video demonstration) 1 Answer

Collision, but then only affect ONE of the gameObjects? 2 Answers

2 objects collide, need to destroy one 2 Answers

Have bullets be destroyed when they collide with ANY collider 0 Answers

OnTriggerEnter with exact spot of collision 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