Unity3D Building and Object Placement & Rotation. Let your players build the world!

Поделиться
HTML-код
  • Опубликовано: 31 дек 2024

Комментарии • 173

  • @ingus2375
    @ingus2375 7 лет назад +73

    It's almost a crime that this video only has 1.8k views. Perfectly explained, very well done and completely solved my problem. thank you very much. Liked and subscribed.

    • @Unity3dCollege
      @Unity3dCollege  7 лет назад +8

      lol thanks :)

    • @itsalwaysoniontime
      @itsalwaysoniontime 4 года назад

      that be true message from pirate sailor

    • @wojtix777
      @wojtix777 3 года назад

      me, watching it 3 years later seeing this video got 38k views happy it got more attention: yes

  • @sleepypigeon743
    @sleepypigeon743 4 года назад +35

    Amazing and informational. Really easy to follow. Thank you for a great tutorial! Had some issues, but I solved them by looking through most comments here:
    I managed to solve the issue with the object flying towards the camera when pressing the key, by changing the layer of the object prefab to "Ignore Raycast". If you need it on Default, you can set it to be on default layer right before making the current selected object null. This way, you cannot place other objects on this object. However, I suggest doing some proximity calculations to not be able to place an object near certain colliders (other buildings, props).
    Another issue was my object sinking halfway into my terrain. I changed its pivot point to be right on the bottom of the object in Blender.

    • @amberlewis012
      @amberlewis012 4 года назад +5

      My god this comment needs more likes it solved my problems

    • @crashie204
      @crashie204 4 года назад +2

      fr this was really helpful ty :D

    • @pabloyourik442
      @pabloyourik442 4 года назад +5

      literally wasted an hour trying to fix that until i remembered to check comments lolol, thanks a tonne ^_^

    • @jeffreyjumisko5165
      @jeffreyjumisko5165 3 года назад

      Thanks. I thought the shuddering effect was that the origin problem, and you can fix the origin problem in Unity by making the prefab a parent of an empty and setting the origin of the empty to 0. Saves a trip into Blender. Cheers!

    • @CraftingTableMC
      @CraftingTableMC 3 года назад

      OH MY GOODNESS YOU SAVED MY LIFE

  • @brandonellis9060
    @brandonellis9060 3 года назад +1

    Even years later, this is still a wonderful video to get object placement and rotation up and running. What a gem!

    • @janakisundaram3502
      @janakisundaram3502 3 года назад

      Worked for 3rd person?

    • @brandonellis9060
      @brandonellis9060 3 года назад

      @@janakisundaram3502 yep, works for my 3rd person camera as well

    • @janakisundaram3502
      @janakisundaram3502 3 года назад

      @@brandonellis9060 For the its cloning the object on the same place, I could not able to move as like in the video

  • @Berndr
    @Berndr 5 лет назад +4

    yeah I agree with previous comment, this is one of the best placement tutorials I have seen ! But there are 2 issues, first objects starts flying towards camera if I stop moving my mouse, 2nd issue might be related to the first problem, object seem to rotate on random axes rather then Y, because it only happens when object start flying towards camera view... placement system only seems to work if you don't rest mouse pointer on same place but keep moving it over map

  • @emersonribeiro-eu
    @emersonribeiro-eu 4 года назад +1

    This is so straight to the point. amazing! You know that a guy is an expert when he explains something that seems to be hard, in the simplest existing way! Thanks!

  • @TheBanned0ne
    @TheBanned0ne 5 лет назад +2

    Holy shit this video is amazing. You explain EXACTLY what you need to do in order to create the basics of a city builder/tower defence. Thanks my man!!

  • @alexmiranda5483
    @alexmiranda5483 4 года назад +1

    5 Stars rating. It solved my long time problem. Explanation is very clear and detailed. Thanks for sharing this video.

  • @АндрейЧурсин-ч7и
    @АндрейЧурсин-ч7и 4 года назад +1

    this is a crime that you got so low subscribers count! Great material and awesome knowledge base! Thank you for sharing!

  • @chrissherwin6423
    @chrissherwin6423 5 лет назад +2

    This had to be one of the best explained videos

  • @rob9x1
    @rob9x1 3 года назад +1

    Excellent tutorial, worked like a charm.
    Just one thing that I was stuck on for awhile yet managed to fix.
    If you create a new player and add a new camera to that one. You will need to set the Tag on the new camera to "Main Camera" or else the script won't manage to find the mousepointer/Cameraview/know where the Raycast will go.

  • @predictonmisson2772
    @predictonmisson2772 4 года назад +1

    This my friend has saved my game. This is exactly what I have been needing to see and find. Subscribed and liked. PS: I hate how easy you made this look but in the same breath I love you...lol Thanks again!

  • @codinx6824
    @codinx6824 5 лет назад +16

    How do I prevent the placed objects from being placed in the same place?

    • @captainoblivious_yt
      @captainoblivious_yt 4 года назад +6

      A little late, but maybe add a trigger on the placed object that recognizes if it collides with another object with the same tag (for example). You make an OnTriggerEnter check for collisions with the same object type, and then make the placement function disabled if it does collide. (Sorry for the poor explanation)

    • @codinx6824
      @codinx6824 4 года назад +4

      Captain Oblivious , well thank you, I solved it a while back the exact same way. at least new people who come here have an answer :)

    • @BerndXYCV
      @BerndXYCV 4 года назад +2

      @@captainoblivious_yt I used the same method but I always wondered how performant this is.
      Another approach I tried was using a dictionary to save the occupied spaces. This should have been pretty efficient but idk if it was even worth it since it did create other problems (having to do more work being one of them ).

  • @jacobkristensson8006
    @jacobkristensson8006 3 года назад +2

    Hey, thanks for an informative video. This helped me a lot in a school project. I'm trying to figure out how I would be able to place the currentplacableobject on top of an already placed object, as it is now it goes right through it even though I added a mesh collider to the objects I place.

  • @MrPonchovie
    @MrPonchovie 2 года назад

    this was precisely what i needed, it was so difficult finding this kind of building tutorial. Thanks!

  • @Akosiyawin
    @Akosiyawin 4 года назад +2

    how can i prevent the prefab rotating like crazy when placed over a pointed ground?

  • @GPaCrewify
    @GPaCrewify 6 лет назад +1

    I always start out seeking my solution with a basic search. I typically randomly click on your videos, see your face, and go. "OH! I LOVE THIS GUY!" *goes to hit subscribe* -already subscribed.

  • @bioman1hazard607
    @bioman1hazard607 5 лет назад +2

    Thank you so much for making this tutorial, now I wonder how to implement this into an online experience. Even a lan version or couch coop would be cool

  • @AgeRestrictTheInternet
    @AgeRestrictTheInternet 6 лет назад +8

    When I use the mouse wheel to rotate the object, it just keeps spinning and spinning :P

  • @tonylanglet
    @tonylanglet 3 года назад +1

    First of thanks a bunch Jason for the great tutorial and you made a function I though would be hard look easy, even though I need to make some customisations to it in order for it to work in my project.
    I have an issue where the FromToRotation or if it's the Instantiation of the prefab turns the prefab in the wrong direct/rotation, I'm new to game development and have a hard time understanding all the transforms and math in it.
    I'm working with a project where you should be able to only place the currentPlacableObject on a specific layer or object (wall), but lets say it's a cube and I want to be able to place the object on each and every side of the cube with the specific rotation of the prefab, any thoughts?

    • @tonylanglet
      @tonylanglet 3 года назад +1

      For me this solved the issue:
      currentPlaceableObject.transform.rotation = Quaternion.FromToRotation(new Vector3(0,0,90), hitInfo.normal);

  • @silentryu9566
    @silentryu9566 4 года назад +2

    This is exactly what I was looking for, thank you so so much !!!

  • @anthonybasang1869
    @anthonybasang1869 5 лет назад +2

    how to make an object stay on the ground while moving using a mouse ?

  • @m4tt3ooo
    @m4tt3ooo 3 года назад +1

    I really love the tutorial but can you make like an updated version with a build countdown? or can somebody tell me how I can implement one?

  • @EscHatchStudio
    @EscHatchStudio 2 года назад

    Hey Jason - great video, very clear, and solved the problem of placing turrets in my new game. Thank you for doing these!

  • @Nokia-px6dp
    @Nokia-px6dp 5 лет назад +1

    how can i make the blocks rotate exactly 90 on key press instead of free rotation like with the middle mouse scroll

  • @brandondoucet9927
    @brandondoucet9927 6 лет назад +2

    Awesome video man, very informational!

  • @haithammahmoud6825
    @haithammahmoud6825 4 года назад +1

    can u plz make tutorial for how to make roads and path like anno 1800
    thanks

  • @TheDJboi2011
    @TheDJboi2011 4 года назад +1

    How do I then "select" and then delete those turrets/towers that I have dropped in game?

  • @insaneduane
    @insaneduane 4 года назад +2

    Great tutorial! I am having trouble instantiating a new object that matches the mouseWheel rotation. I have a "ghost" prefab that I am dragging around and it rotates beautifully BUT when I click to instantiate the real building (not the ghost) everything is great EXCEPT the mouseWheelRotation += Input.mouseScrollDelta.y; value.
    Any help would be much appreciated.
    Thank you for your very informative videos. They have helped me tremendously!

  • @nevetsmahgnirtle8961
    @nevetsmahgnirtle8961 6 лет назад

    Brilliant tutorial! This is the first one that has actually worked for me. Liked and subscribed. Thanks very much for your work!

    • @Unity3dCollege
      @Unity3dCollege  6 лет назад

      Great! Glad it was helpful! :)

    • @nevetsmahgnirtle8961
      @nevetsmahgnirtle8961 6 лет назад

      More than helpful. I'd love to know how to use this script to snap the game object to a grid if you ever have the time and enough requests. Thanks again.

  • @crashie204
    @crashie204 4 года назад +2

    this video was really helpful even after 3 years! only issue im facing right now is that when im trying to put a prefab/ game object that has a rotation, it doesnt rotate the way that it is pre-set, it always resets to the Vector3.up rotation im guessing. i cant think of how to fix it. but thank you for the video it was just what i needed :D

    • @crashie204
      @crashie204 4 года назад +1

      it was becuz of the anchor points of the models, i fixed it in blender. now im trying to make it so that a model doesn't build if it collides with another and also that you can build models on top of eachother but idk how :/

  • @JK142_Cool
    @JK142_Cool 5 лет назад +2

    when i press A the object is flying towards the camera over and over again, what did i do wrong?

    • @AdmiralMoo
      @AdmiralMoo 5 лет назад +1

      Add a LayerMask. Every object in the scene is in the default layer, so the raycast is hitting the camera too. Just declare the public layermask at the top so you can set it in the inspector, create a new layer (I called mine placeableTerrain), and add the layermask to the raycast. Remember to put the surface you're placing on into the layer that you created
      public LayerMask HitLayers;
      ---------------------------------------------
      if (Physics.Raycast(ray, out hitInfo, Mathf.Infinity, HitLayers)) {

    • @gatlas90
      @gatlas90 5 лет назад

      @@AdmiralMoo thanks! you saved me

  • @taenalive1711
    @taenalive1711 3 года назад +1

    Amazing tutorial and information about the codes. Does this work for first person too? I can't seem to get mine to work because the prefab forces itself to spawn with its coordinates in Unity rather than the camera on my player.

  • @linkid2601
    @linkid2601 5 лет назад

    Simple and the most import straight to the business…. awesome. Liked and sub!

  • @fianDev
    @fianDev 2 года назад +2

    Why is it that when placing an object it is dragged to the camera?

    • @Unity3dCollege
      @Unity3dCollege  2 года назад +1

      it's finding the collider on the object, make sure the layers are correct and it's ignoring the object you're trying to move (usually with the layermask)

  • @DanielLopez-tp9hi
    @DanielLopez-tp9hi 3 года назад +1

    Nice vid, love the way you explain it, with so much ease! i seem to be having an issue tho, when the object i want to place spawns it keeps moving towards the screen and then it starts looping, what could be the problem here?

    • @martinthorpe7410
      @martinthorpe7410 2 года назад

      Hey I know you commented this a long time ago but I had the same issue, incase you never knew how to fix it, removing the box collider from the prefab I was placing worked for me.

  • @tataeress1793
    @tataeress1793 4 года назад +2

    you should probably add Terrain keyword on the video so that people find it ( it took quite a time to find such a video)

  • @codinx6824
    @codinx6824 5 лет назад +8

    how do I prevent objects being placed on the same place, I tried with colliders but its just making the objects fly and move randomly.

    • @shachar2
      @shachar2 5 лет назад +4

      I'm guessing that you have to check when you move the object with the mouse if there's another object or a collider nearby, then make some visual (red) or disappear the held item (or throw a debug.log/print as a start).
      oh that's when "hovering"
      you need another check when the user tries to "pin" (?) the item back into the world and give some kind of text error.
      another solution that I just thought of is when placing the object to turn the mash/collider on.
      actually this might be a better solution since if you have moving objects in-game (say people or the like) then they probably shouldn't collide with the mouse moving object...

  • @nitro1823
    @nitro1823 5 лет назад +1

    Hi Jason, what would you need to add to prevent the clones from overlapping?

    • @surprisebatseks
      @surprisebatseks 5 лет назад +1

      maybe use colliders as trigger to see if there is another collider blocking the spot.

  • @AlexandruMarean
    @AlexandruMarean 5 лет назад +1

    I don't understand why but when i click A, the prefab start to make a repeat movement [planeposition to camera and back] How can i fix this ?

  • @johnathanclaasen7996
    @johnathanclaasen7996 5 лет назад

    Awesome tutorial, Helped me a lot and the way you describe everything was very nice. Easy to follow. needs more likes!!!!!

  • @raistlinmajere2257
    @raistlinmajere2257 4 года назад

    Thank You for the knowledge, Jason.

  • @UpcomingPlayChannel
    @UpcomingPlayChannel 2 года назад

    Hey can we make it for Scene prefab building like prefab brush ?

  • @snazzy8903
    @snazzy8903 3 года назад

    Something that i came across: If your prefab is launching itself towards the camera, just simply disable the prefabs collision. Should work as intended there after!

  • @bobh8374
    @bobh8374 5 лет назад

    Can you do a tutorial about game set up? For example, before getting into the game world, you set up the game by naming your person, setting difficulty, among other options and have the game use those options that you selected when you get in the game world.

  • @headrushgaming2614
    @headrushgaming2614 2 года назад

    I'm struggling so much in my game at the moment, i need help desperately! I'm trying to create a save system that records the position and rotation of building pieces, the building pieces are scriptable objects and I instantiate them in as game objects, but I can't for the life of me figure out how to record and store game objects values and then load them again. so that a player can build a house and then when they load up again they're still there, please would you help me?

  • @jonathanwanford1473
    @jonathanwanford1473 3 года назад

    Thank you Jason, great video.
    I have two problems though, My raycast doesn't seem to line up with my camera? it shows the prefab on the ground but its not where my mouse is?
    Secondly, All of my prefabs seem to be rotated by 90 when they appear?
    If anybody has any suggestions they would be greatly appreciated please!

  • @Mika-vw4bt
    @Mika-vw4bt 7 лет назад +1

    I, i like this. U think is possible to make this tutorial with snap to grid ? :p

  • @janakisundaram3502
    @janakisundaram3502 3 года назад

    how to make it work in third person controller

  • @emperorpengu4833
    @emperorpengu4833 6 лет назад +2

    Why my object glitch in the terrain, its only half of my object can be seen? its already have terrain colliders, etc.

    • @GPaCrewify
      @GPaCrewify 6 лет назад +2

      For anyone having this problem, your pivot point is set to center on your object. Either export with your pivot point where you want it or, parent to an empty with the desired pivot point.

  • @Qaztar44
    @Qaztar44 6 лет назад +3

    Not sure if you're still checking the comments for this but I thought I'd ask anyway. This video is awesome, but my problem is that (unlike the other guy in the comments) I'm not sure how to get it so that I can place objects on top of other objects that have been placed. I can do it, but then I have the layer raycast problem where the object flies at me. If I ignore the raycast for that object, I can no longer place other objects on top of it once I place it. Any solution to this?

    • @Unity3dCollege
      @Unity3dCollege  6 лет назад +5

      In that case, I'd put the object onto a different layer while it's in 'placement mode', then switch it to the correct layer once the user clicks and places the object. That way it can be ignored while you're moving it around and getting it in position.. but still placed upon once it's down. Hope that made sense :)

    • @Qaztar44
      @Qaztar44 6 лет назад

      Gotcha. Hmm, guess I gotta look something up for that (I'm not too fluent just yet)

    • @janakisundaram3502
      @janakisundaram3502 3 года назад

      @@Qaztar44 Got any solution?

  • @nkwuaprecious
    @nkwuaprecious 2 года назад

    how can we get the assets you used?

  • @7gugts3d4ROBOTufyuguhihimpl9
    @7gugts3d4ROBOTufyuguhihimpl9 6 лет назад +1

    How do make so i cant place on a other gameobject?
    sorry for bad english

  • @Joe-kc7ii
    @Joe-kc7ii 6 лет назад +2

    How can i make it, so when i press a button, it changes the placeableObjectPrefab? I have trouble with that.

    • @ThePandasWorkshop
      @ThePandasWorkshop 6 лет назад

      he made another video: ruclips.net/video/MbOdWBirf1o/видео.html

  • @dsahgkg
    @dsahgkg 7 лет назад +1

    you the man!
    you're helping college students all over the world my man!

  • @aspiron9438
    @aspiron9438 6 лет назад +6

    Does anyone have a solution for the problem with the object moving to camera?
    I tested it out and these are my layers: i.imgur.com/CToUeWE.jpg
    It works now!

    • @BusinessCats
      @BusinessCats 4 года назад

      How did you fix it?? I have the same problem

    • @david8j796
      @david8j796 4 года назад

      How did you fix it?

    • @amberlewis012
      @amberlewis012 4 года назад +3

      If you haven't fixed it yet, you have to set the object's layer to "ignore raycast" (there's also another method that seems a bit more complicated but probably works better, go look for admiral moo)

  • @antoninjury3139
    @antoninjury3139 7 лет назад +1

    Hi!! Thanks for this great tuto!!
    But when the object has a Box/Mesh Collider, it doesn't work very well, with an odd glitch! Do you have any tip or suggestion to avoid this ? Thanks again!

    • @Unity3dCollege
      @Unity3dCollege  7 лет назад +2

      What was the glitch you saw? One possible problem would be that the pivot point of those objects by default is the center, and for sticking to the ground, you generally want it at the bottom center.

    • @antoninjury3139
      @antoninjury3139 7 лет назад

      Hard to see here, but my building is making an "epileptic crisis" : image.noelshack.com/fichiers/2017/39/7/1506891799-a-effacer.jpg
      Ahah ! Thanks for advice, I tried to remove the pivot point, but it makes the same effect :'( . Another thing, I tried to apply this to an animal with RigidBody, Box Collider ad NavMesh Agent, and it made something odd too, my animal passed below the ground! I think it's pretty complex to fix, but I wanted to warn you of this problem I've encountered! Never know! Thanks for the very quick reply!

    • @Unity3dCollege
      @Unity3dCollege  7 лет назад +4

      If it looks like the object is coming right at you, it may be the layer issue. (the raycast has to ignore the layer the object being placed is on or it'll keep moving toward the camera and eventually pop back to the ground repeating the process infinitely)

    • @antoninjury3139
      @antoninjury3139 7 лет назад

      Thanks a lot, it seems to work, sorry, I'm a really beginner, I suscribe immediatly to your channel :* ! Thanks again !

    • @Unity3dCollege
      @Unity3dCollege  7 лет назад +1

      Awesome, glad that worked :)

  • @h38-m9e
    @h38-m9e 4 года назад +1

    Would this work with a first person controller?

    • @Acidpop
      @Acidpop 4 года назад

      it does for me

  • @FrozenGaming
    @FrozenGaming 4 года назад +1

    Can anyone help me out here please? Everything works perfect but I need to make it work on a certain radius from my player. Any ideas? Thanks Jason for your tutorial!

    • @MileIotecrew
      @MileIotecrew 4 года назад +1

      You can use hitinfo.distance and check with an if statement if the distance is bigger or smaller than a value.

    • @MileIotecrew
      @MileIotecrew 4 года назад +1

      or just add a ", yourfloat" after the hininfo. To define the max. length of the ray.

    • @captainoblivious_yt
      @captainoblivious_yt 4 года назад

      Check the distance of the raycast, and do a if(hitInfo.distance < 10f), then run the code. Then just do an else { return; }

  • @b-l1969
    @b-l1969 2 года назад

    Wow... the best explained I've seen!
    I know this is 5 years old at this point, but, why to some games/devs opt to do a grid placement/limited rotation instead of freeform like this? Is there a resource advantage to it?

  • @joeyvanalphen5589
    @joeyvanalphen5589 6 лет назад +1

    Can you please make something that you could swap between prefabs? It would mean a lot to me 😁 really good tutorial by the way

    • @Unity3dCollege
      @Unity3dCollege  6 лет назад +2

      Here ya go: ruclips.net/video/MbOdWBirf1o/видео.html

  • @herrschwarz5406
    @herrschwarz5406 6 лет назад

    Another very useful Tutorial.
    Thx!

  • @EEEEEE1337
    @EEEEEE1337 6 лет назад

    Nice tutorial, thanks for this little lesson :)

  • @Gramnin
    @Gramnin 6 лет назад

    Overall a great tutorial! I'm only having one problem - I used just a normal cube as my placeable object, but when I place the cube, it places the center of the cube where my mouse position is. I can't seem to figure out how to go about fixing this.

    • @joonauutela581
      @joonauutela581 5 лет назад

      you need to recalculate the y-coordinate using your cubes y-scale divided by two.

    • @captainoblivious_yt
      @captainoblivious_yt 4 года назад +3

      @@joonauutela581 You could do that, or simply parent the cube to an empty gameobject that is placed at the very bottom of the cube's geometry, then just use the parent gameobject as the placeable object.

  • @youtuberyoutuber2495
    @youtuberyoutuber2495 5 лет назад

    I need help. After creating it with "z", it does not attach to the mouse cursor like what the guy has in the video, instead, it always goes to the same spot on the map, and hitting left click with the mouse places it no matter where the cursor is. its being created where I last had it on the map. I had to put the image on the map first so I can adjust the size. I did everything that was in the video. im using Unity 2d if that helps.

    • @silentryu9566
      @silentryu9566 4 года назад

      Instead of using vector3 use vector2, you might also have to fix some other code but that’s the simplest answer I can give uou

  • @3dfuture.ledcanvas
    @3dfuture.ledcanvas 7 лет назад

    Great! I wanted to know this one!

  • @InTheStevening
    @InTheStevening 4 года назад

    The only bad thing is the nostril camera. Thanks for the excellent tutorial!

  • @danny_devlog
    @danny_devlog 7 лет назад

    Great tutorial! But I have some issues. When I used game object that have Rigidbody / Collider, it goes up! Help please...

    • @tarikhusny7116
      @tarikhusny7116 6 лет назад

      Make your prefab's layer on "Ignore Raycast" than you can enable colliders.

  • @chriscosby6612
    @chriscosby6612 7 лет назад +1

    Awesome tutorial! I wish I was as fluent as you. Any chance you could show how to create a UI system that would allow the player to configure customized commands to control an avatar?

  • @drnagol
    @drnagol 4 года назад

    this tutorial was easy to follow and had a great outcome.

  • @CraftingTableMC
    @CraftingTableMC 3 года назад

    Thank you so much!

  • @Sebbo1298
    @Sebbo1298 4 года назад

    I have this working, apart from that my models are taking a good 10 seconds or so to appear after I press the button. Does anyone have an idea what's caused this?
    Great Tutorial by the way, even 3 years later!

    • @Sebbo1298
      @Sebbo1298 4 года назад +1

      I figured it out. I was using some free assets fromt the Unity Asset Store which came with animation components.
      I went into each FBX in my assets and under the 'Animation' tab, I un-ticked 'Import Animation'. My prefabs load instantly now!

  • @jeandredegenaar9292
    @jeandredegenaar9292 7 лет назад +1

    How would I make it that you can't place buildings on buildings

    • @jeandredegenaar9292
      @jeandredegenaar9292 7 лет назад

      In

    • @XxjazzperxX
      @XxjazzperxX 7 лет назад +1

      (havent actually seen the video, so you should take this response with a grain of salt.)
      You could make a collider on the prefab and then make it unplaceable or something, when 2 objects collide. Maybe mark the placing object with red for visual representation.

  • @samferr16
    @samferr16 7 лет назад +5

    When I try placing the object it starts floating to me me indefinitely. I read some comments below that I need to disable 'Generate Colliders' on the object, but I also want to be able to drag and drop the object after it's already been placed, which requires it to have 'Generate Colliders'. Is there any way around this, or do you know if there are any other scripts where I can drag and drop the object after it has been placed without 'Generate Colliders' ticked on? I would appreciate it very much if you could help. Thanks :)

    • @tarikhusny7116
      @tarikhusny7116 6 лет назад +5

      Make your prefab's layer on "Ignore Raycast" than you can enable colliders.

    • @thefootballaddict2888
      @thefootballaddict2888 6 лет назад

      Thx Tarik

    • @플레이아로테
      @플레이아로테 6 лет назад

      Thank you so much! Tarik

    • @BrianBakerCA
      @BrianBakerCA 6 лет назад +5

      Add this line under the Instantiate line:
      currentPlaceableObject.layer = LayerMask.NameToLayer ("Ignore Raycast");
      and this one above "currentPlaceableObject = null;"
      currentPlaceableObject.layer = LayerMask.NameToLayer ("Default");
      My buildings need to receive clicks after they're placed, so I can't just keep them on ignore raycast

    • @tobotheamazing6074
      @tobotheamazing6074 5 лет назад

      thanks heaps
      @@tarikhusny7116

  • @jiyu4149
    @jiyu4149 5 лет назад

    whys is my Object Levitates from the hitpoint to the center of the camera, hoping for reply, thanks.

    • @shachar2
      @shachar2 5 лет назад +1

      I have this problem as well. it's because the object is being placed upon itself because it has a mash (a collider)
      one solution is to make sure that the ray only hits say object with tag ground or buildable.
      There is a better solution then tags (because tags causes a performance issue if you use lots of them) that I've seen on youtube but it went over my head and I don't remember it.

    • @jiyu4149
      @jiyu4149 5 лет назад +1

      @@shachar2 thank you for reaching out. I somehow tried your idea by using Layer instead of Tag, and it works the way i wanted now.

    • @markomrkonjic7002
      @markomrkonjic7002 5 лет назад

      @@jiyu4149 well mates i have same problem xD my Object is levitating above ground and causes strange glitches any way to solve ?.

  • @garrettlee2524
    @garrettlee2524 7 лет назад

    So I used your code and for the most part it works. However the prefab I'm using rotates rapidly and floats toward me when I press the build hot key. Any suggestions?

    • @Unity3dCollege
      @Unity3dCollege  7 лет назад +1

      It sounds like you're missing the layer / layermask and the placement ray is hitting the object. Can you check that?

    • @raintrain
      @raintrain 4 года назад +1

      @@Unity3dCollege having the same issue, but in your video i cant see which layer / layermask i could miss ? all your layers are default

    • @yohaneskevin1633
      @yohaneskevin1633 4 года назад +1

      i have the same issue

  • @roboworld7484
    @roboworld7484 6 лет назад

    Cool stuff!! Man

  • @AlexThe18709
    @AlexThe18709 7 лет назад

    Hey not seeing any links or source in the description

    • @Unity3dCollege
      @Unity3dCollege  7 лет назад

      Thanks for pointing this out, just fixed it. Here's the link btw: unity3d.college/2017/08/02/how-to-create-a-unity3d-building-placement-system-for-rts-or-city-builders-let-your-player-place-a-3d-object-in-the-world/

    • @AlexThe18709
      @AlexThe18709 7 лет назад +1

      Unity3d College I actually ended up at that page late last night trying to solve the problem mentioned below. I don't want to bother you with it though because I just used your code as a base and have modified it a bit. Thanks for the update and the swift reply though!

  • @InfiniteArts
    @InfiniteArts 7 лет назад

    My object move up, i don't know how i can fix that

    • @Unity3dCollege
      @Unity3dCollege  7 лет назад +2

      If you'd like to zip up your project and send it to me I can see what's going on. jason @ unity3d.college

    • @InfiniteArts
      @InfiniteArts 7 лет назад

      Made it, thanks

    • @CheloKabbab
      @CheloKabbab 7 лет назад

      I have the same problem? the object keeps flying towards the camera. Any fix?

    • @InfiniteArts
      @InfiniteArts 7 лет назад +1

      Yep, thanks Unity3d College, He tell me the issue, you need to disable te object collider ;)

    • @R3puLsiv3
      @R3puLsiv3 7 лет назад

      Thanks that helped!

  • @boringNW
    @boringNW 6 лет назад

    Thank you!

  • @Akosiyawin
    @Akosiyawin 4 года назад +1

    wtf my object that i want to place in the ground is coming over to my camera hahaha how to fix that?

    • @vancedk16
      @vancedk16 4 года назад

      Same thing is happening to me. Could you help us out?

    • @Akosiyawin
      @Akosiyawin 4 года назад

      @@vancedk16 it's simple, make sure the prefab object has the tag Ignore Raycast

    • @Akosiyawin
      @Akosiyawin 4 года назад

      @@vancedk16 you don't have to create one, it's already created, find it on the tag list

  • @notsonerdgaming3406
    @notsonerdgaming3406 4 года назад

    my rotation is getting reset and you never fixed it....

  • @mhdnaderlabbad5887
    @mhdnaderlabbad5887 5 лет назад

    why you are the best :)

  • @danny_devlog
    @danny_devlog 7 лет назад +5

    Ooops! I just forgot to set the layerMask.... problem solved.

  • @redmanone3724
    @redmanone3724 6 лет назад

    Thanks!

  • @slav4ou
    @slav4ou 3 года назад

    coool!

  • @rickhernandez8301
    @rickhernandez8301 7 лет назад +2

    Oh snap! Green screen.

  • @GG-ww3lu
    @GG-ww3lu Год назад

    7:05

  • @Akosiyawin
    @Akosiyawin 4 года назад

    Dude I subbed! you are fckin good!

  • @Shkedias
    @Shkedias 4 года назад

    ❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤

  • @tottinhinho3863
    @tottinhinho3863 6 лет назад

    For mobile please bro. Thank you!

    • @amberlewis012
      @amberlewis012 4 года назад

      I'm a year late but....are you asking for a tutorial for mobile or what? Because if so, why would you try to make a game with a phone?

  • @MinecraftiaBunny
    @MinecraftiaBunny 6 лет назад

    Just a tip, Lose the face cam! it's off-putting, because this is a semi-tutorial, it isn't needed

  • @LiittleSoul
    @LiittleSoul 3 года назад

    Thanks!