Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

A little help with selecting a side of a specific object

Discussion in 'Scripting' started by lib87, Aug 28, 2015.

  1. lib87

    lib87

    Joined:
    Aug 28, 2015
    Posts:
    17
    Hi

    I checked many different topics videos and sources but couldnt find what i want exactly. Im a msc student who writes his dissertation project (which is a game in unity). I need to be able to pick a specific surface from an object.

    As you can see from the picture above i have 2 objects (cubes) and i put (just to test purposes) 2 more smaller blue boxes inside of them. All i need is to select (either the big box only one surface not whole box) or second smaller box. Right now with the code im using i have to put rigidbody to smaller (blue) boxes which cause a collision with each other (btw smaller blue box is a child of original (bigger white) box). I put them together cuz they have to move together without hitting each other.

    I hope im clear enough :/

    I will be very happy if someone can help me.

    Thank you.

    PS: I can provide more details if you wish to
     
  2. Duugu

    Duugu

    Joined:
    May 23, 2015
    Posts:
    241
    Could you please specify "select" and "pick"? What is your exact intention?
     
  3. lib87

    lib87

    Joined:
    Aug 28, 2015
    Posts:
    17
    Im going to select that specified surface. Then i will select the second surfce and make them move towards each other.

    PS: I used planes instead of boxes (small blue ones) in rigidbody kinematic ticked and it worked :) So now i can sleect the surface of the plane. even if i move the big box plane comes with it. Despite this I would like to know if there is any other way to pick a surface of an object rather than selecting the whole box with one click.

    Anddd thank you for your reply
     
  4. Duugu

    Duugu

    Joined:
    May 23, 2015
    Posts:
    241
    Ah, this is about working with gameobject in the editor? Modifying the gameobjects mesh via the editor?
    As this is the Scripting forum I thought you're trying to move or modify a gameobject via a script. :)

    Imho there's no way to select only some part of a gameobject or to modify a mesh via the editor.
     
  5. lib87

    lib87

    Joined:
    Aug 28, 2015
    Posts:
    17
    I actually did need scripting to select the side of an object. Now i can select/pick a side. I used ray cast.