Search Unity

Instantiate: Collision inconsistent

Discussion in 'Editor & General Support' started by yellowlabrador, Jul 18, 2006.

  1. yellowlabrador

    yellowlabrador

    Joined:
    Oct 20, 2005
    Posts:
    562
    Hello All,

    Attaching a file of my little project.
    The collision I'm having with the instantiated object explosion is inconsistent. Sometimes it will collide with the mesh collider and explodes and sometimes it will not. Tried replacing and also adding a box collider to the objects and still have the inconsistency issue. Using standard scripts from the FPS tut.

    If the sphere(missile) has a rigidbody attached to it, it should collide with a mesh collider, if you try to shoot on some areas of the mesh, collision is detected but not on some.

    Controls is just the mouse. LMB to shoot, mouse to rotate.

    Thanks,
    Ray
     

    Attached Files:

  2. elias723

    elias723

    Joined:
    Feb 10, 2006
    Posts:
    178
    The projectiles you are firing are just going through the of the mesh unless the collision occurs close enough to a vertex of the mesh. I had this problem, too, when I was beginning.

    1. You can make the collider on the projectile bigger.
    2. You could also just divide your mesh into more polygons, giving you more vertices.
    3. Also, you could make your mesh double-layered (two sided) so that the projectile has two surfaces to run into and not just one - that way if it goes through the first one it will hit the second one.
     
  3. yellowlabrador

    yellowlabrador

    Joined:
    Oct 20, 2005
    Posts:
    562
    Thanks elias,

    I just made the sphere collider radius bigger.

    I always had the understanding that as long as there is a collider attached to an object it should detect any collision. Not aware of some vertices issue.

    Thanks Again! :)

    Ray
     
  4. BadMonkey

    BadMonkey

    Joined:
    Oct 15, 2005
    Posts:
    55
    I'm not so sure about the vertex issue and the need to sub-divide meshes .... that sounds like a red herring I'm afraid. My experience shows that the project settings for Time and Physics are extremely critical when dealing with collisions. If you have small objects and/or fast moving objects then the default settings probably need to be tweaked. Reducing the Fixed Timestep and/or Min Penetration For Penalty should help a lot. It can be tricky to find the right values that suit your project sometimes ... almost a game in itself :wink:

    Paul