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 /
avatar image
0
Question by BANNERTM · Mar 21, 2012 at 12:01 PM · collidersspeed

Colliders don't work when object has large speed!

Colliders don't collide when object has large speed and object goes through walls!!! But with low speed colidrs work perfectly.

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

3 Replies

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

Answer by syclamoth · Mar 21, 2012 at 12:06 PM

Are we talking about bullets here? Small objects travelling at high speed? Look up raycast colliders and linecasting. Simply, you need to improve on the basic collision detection provided by physics by using Physics.LineCast(previousPoint, currentPoint)- this will detect if the bullet should have hit a wall.

If that's not enough detail for you, feel free to use the search bar like you should have done before posting this.

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 BANNERTM · Mar 21, 2012 at 12:16 PM 0
Share

it's not bullet, it is metal ball.

avatar image BANNERTM · Mar 21, 2012 at 07:43 PM 0
Share

How to use physics.linecast? Yes, i saw Unity script reference

avatar image syclamoth · Mar 21, 2012 at 10:01 PM 1
Share

See! Look at all the other answers. Come on, there are step-by-step instructions actually in the manual you claim to have read. And in any case, you didn't specify what the object was but explain to me- in what way is a bullet not kind of "metal ball"?

avatar image
1

Answer by Rabbit-Stew-dio · Mar 21, 2012 at 01:04 PM

The physics engine uses discrete steps to test for collisions by default. The "fixedUpdate" runs several times per frame. On each fixed-update your model is tested for collisions. When you use "discrete" collision tests, your objects jumps between frames.

When your object is small and fast moving, these jumps can make you miss collisions inbetween.

Example: Assume you have a bullet flying at 1000m/s. The setting for Fixed Timestep (via "Edit->Project Settings->Time") is left at 0.02s. That means your bullet jumps through the scene in 20m steps (1000m/s * 0.02s = 20m).

To make sure your bullet hits everything, you have three options:

(1) You can make the Fixed Step setting smaller. To test for each meter, you would have to set it to 0.001 instead. Drawback: This makes your physics calculation 20 times more expensive (0.02 / 0.001 = 20), as you now invoke "fixedUpdate" 20 times more often for each frame.

(2) You can set your collide-setting on the bullet's rigidbody to "continuous" or "continuous-discrete".

(3) You can do it manually by adding a script to your bullet that linecasts backward as described by syclamoth.

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 fafase · Mar 21, 2012 at 01:28 PM 0
Share

I would use the raycast as I would think is less computation hungry and result is the same. Should you want to see the actual bullet flying, you could still instantiate the bullet for visual effect(maybe even with a tiny particle trail) and raycast for collision. Any suggestions?

avatar image
0

Answer by fafase · Mar 21, 2012 at 12:24 PM

This is a common frame displacement problem in computer game.

Your object is moving at high speed let's say 500m/s, if you run at 100fps that 5m/fps so every frame your bullet is skipping 5m. If you stand at 0 then it will hit at 5 ,10, 15... but in between, safety.

That is why as mentioned by @syclamoth you need to use raycast. Or both but at least raycast.

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

bullets flying through enemy 1 Answer

physics.OverlapSphere colliders 1 Answer

Speed/trigger only working once 0 Answers

Rotation Ease-In-Out with MAX Rotation Speed 1 Answer

Pathfinding with specific end-direction and turning speed limit 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