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 TacoShank · Nov 05, 2011 at 05:00 PM · physicscollider

Colliders Not Doing Their Job

So I have a pretty annoying problem.

I've been using the FPS Constructor Weapons Package V 0.95 to throw some weapons together really quick, however, one weapon in particular, the rocket launcher, is not behaving like I would want it to.

Basically the rocket only hits the surface of my boxcollider-based floor about 80% of the time, and only hits my meshcollider-based surfaces about 10% of the time. Now I've heard about how mesh colliders can be worse for fast traveling rigidbodys etc. but I certainly am not going to manually put primitive colliders into my ENTIRE map.

I've heard of solutions to this "quantum tunneling" problem, that include raycasting and other techniques but I really have no idea where to start on this. Any input is welcome.

Here is the related script for the grenade/rocket function:

grenade.js

 var delay = 1.0;
 var timeOut = 1.0;
 var detachChildren = false;
 var explosion : Transform;
 var explodeAfterBounce : boolean = false;
 private var hasCollided : boolean = false;
 private var explodeTime : float;
 //private var hasExploded : boolean = false;
 
 function Start (){
 explodeTime = Time.time+timeOut;
 }
 
 function OnCollisionEnter (collision : Collision){
     if(hasCollided || !explodeAfterBounce)
         DestroyNow();
     yield new WaitForSeconds(delay);
     hasCollided = true;
 
 }
 function DestroyNow ()
 {
 //    if(hasCollided){
         if (detachChildren) {
             transform.DetachChildren ();
         }
         DestroyObject (gameObject);
         if (explosion)
             Instantiate (explosion, transform.position, transform.rotation);
 //    } else {
 //        return;
 //    }
 
 }
 function Update () {
    var direction = transform.TransformDirection(Vector3.forward);
    var hit : RaycastHit;
    if(Time.time > explodeTime){
        DestroyNow();
    }
 }

Thanks for all the help!

~TacoShank

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
1

Answer by Eric5h5 · Nov 05, 2011 at 05:20 PM

Use continuous dynamic for the collision detection instead of discrete. And/or increase the rate at which physics runs in the time settings; by default it's 50fps (.02).

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 TacoShank · Nov 06, 2011 at 05:22 AM 0
Share

Well using continuous dynamic doesn't have an effect on the box collider at all, and it makes the rocket bounce off of the mesh colliders. Also, I don't want to sacrifice efficiency by going with a higher physics rate, there has to be a better way of doing this.

avatar image
0

Answer by Persona · Nov 05, 2011 at 05:16 PM

You can set up so that when the distance between a rocket and an object with a wall tags is less than 1 unit away, have it detonate.

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 TacoShank · Nov 06, 2011 at 05:27 AM 0
Share

How is this any different then using colliders? That 1 unit away window would be prone to the exact same problems as the colliders wouldn't it?

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

Physics.Raycast not checking layermask properly? 1 Answer

Get a bounding sphere for collider/rigidbody? 0 Answers

Creating a SIMPLE car. 1 Answer

Same reaction with different number of objects colliding 2 Answers

Manual collision check 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