Search Unity

How Do I Do This?

Discussion in 'Scripting' started by imunirbesye, Dec 11, 2018.

  1. imunirbesye

    imunirbesye

    Joined:
    Oct 27, 2018
    Posts:
    57
    I want a gameObject passed a Circle's inside but I cant't do that. I've tried to add a Sphere inside of it and use its collider but it didn't work. I've also tried to get x and y coordinates and get object's too and compare them so it is inside of that circle but it also didn' work how can I do this?
     
  2. It's maybe me, because I'm just on my first coffee today, but I don't understand what is it you're trying to do, could you please rephrase your question?
     
    SparrowGS and lordofduct like this.
  3. imunirbesye

    imunirbesye

    Joined:
    Oct 27, 2018
    Posts:
    57
    I have a circle and a gameObject. I want that gameObject pass throug circle.
     
  4. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,778
    Please show some picture, of what you trying to do.
     
  5. imunirbesye

    imunirbesye

    Joined:
    Oct 27, 2018
    Posts:
    57
    I want to do this but if I pass around it still turn diffrent color I dont want to do that. I just want to pass through of it.
     

    Attached Files:

  6. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,778
    You will need mesh collider of the loop.
     
    mholmes likes this.
  7. imunirbesye

    imunirbesye

    Joined:
    Oct 27, 2018
    Posts:
    57
    I tried it but can't figure it out. So I did this. I can pass through it and it counts. If I pass outside of it it still counts and ı dont want that. How can I do that using coordinates?
     
  8. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,778
    Way how you describe things, is very poor.
    It makes very difficult to get any idea, what you really want.
    If you want just count passing through. Use other collider inside and apply OnCollisionEnter.
    If you want use position as reference, use difference between two vectors and get from them squared magnitude, and check its value against desired tolerance.
     
    lordofduct likes this.
  9. imunirbesye

    imunirbesye

    Joined:
    Oct 27, 2018
    Posts:
    57
    I figured it out. :D I did 2 calculations then it is working for now :D