Search Unity

Collider for Terrain not working and Setting up a bullet projectile.

Discussion in 'Scripting' started by aditya_tirodkar, Sep 12, 2012.

  1. aditya_tirodkar

    aditya_tirodkar

    Joined:
    Sep 12, 2012
    Posts:
    7
    Hey guys,

    I'm new to Unity3D (almost a day now) and am working with making sort of an adventure game for a college project. I am facing the following issues.

    I made a terrain with mountains and trees etc. However, it turn out that I am still able to walk through the trees and the mountains. I tried making the terrain a rigid body, however this led to the whole terrain falling down (with gravity active) or my player character suddenly flying up. Can someone please help me out with this.

    On a side node, I went to eh Unity fps tutorial and made a projectile gun. I want my projectiles to disappear after they stop moving (They are like rocks being thrown). I used the destroy object using ActiveVelocity and Speed. However, I am still unable to get them to disappear.

    Please help me out with this, I really need to get this work done by next week.

    Thanks!
     
  2. Falin

    Falin

    Joined:
    Sep 29, 2009
    Posts:
    242
    Do your trees/mountains have colliders(box/mesh)?
    Also what you can do is when your bullet hits something it gets destroyed.
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    you will need to place the colliders in the scene.
    The unity terrain system ignores prefab data when placing foliage / detail objects, as such you can't add colliders etc to them.

    the only form of adding collision would normally be through the corresponding checkbox in Unity to generate colliders for the trees, but I've yet to see that one doing anything usefull
     
  4. aditya_tirodkar

    aditya_tirodkar

    Joined:
    Sep 12, 2012
    Posts:
    7
    Hey, I think both the tree from which the "terrain"trees are based on as well as the terrain itself have colliders. I've attached pics that give info about them both. Do check if you can see anything.
     
  5. aditya_tirodkar

    aditya_tirodkar

    Joined:
    Sep 12, 2012
    Posts:
    7
    kk.......Can you possibly tell me what script or logic I should use for getting this? Or possibly redirect me to one. Currently yes, my bullets should be able to hit a wall which encloses the whole terrain. However, this is contingent on the presence of a collider.