Thank you! I'm not a native british or american, but i understood all frazes or words. My english level not low, and not high. The most best part of your tutorial is code. U make code so easy that hard to didn't undrestand what happen in video. One more - Thank you! +rep
This is extremely useful. I've been trying to get started on a base-building game and what I want to accomplish first is to make it possible to plop down objects (buildings) of various dimensions (1x1, 2x3) on a grid. So I'm looking forward to the rest of the series. Thanks!
To anyone having trouble with the Mouse Indicator Testing part, make sure you have a mesh collider on the plane you are using as your grid. Also, to anyone having trouble with the Cursor Indicator not aligning with the cursor, make sure it has the correct Y position as it is different in the game than in the scene viewport. Spend time to make sure it is perfectly level in the game when you hit play (it doesn't matter if it is below the plane in the scene mode).
Thank you - again... Great work and alyways exactly what I'm looking for. As soon as I (or if I ever) earn some money with my Games, I will support you financially as well.
Thanks. And be sure to focused on making games first 👍 Making money from games is kind of separate skill and I don't think it is easy to learn it and make games at the same time 🙂
Hey Peter, thanks for this tutorial! Grid system is something i’ve had trouble with in the past, so I’m looking forward to learning how to implement this
Great vid. By the way this creator also has courses on Udemy. Several of the courses are great for people who have got the fundamentals of Unity and coding under their belt and need to start learning architecture, design patterns and internal testing.
Just what the doctor ordered! I can't wait to use this in the game. I'll definitely be buying your course. One question: my game is currently using Unity 2021. Is it a must to upgrade to 2022?
As long as you are using Unity 2021.2 and above there should be no issues. This is because I am using C#9 features docs.unity3d.com/2021.2/Documentation/Manual/CSharpCompiler.html I am not sure about the shader part since this changes a lot (we are using a shader graph). But its something that you can convert easily - well you would recreate the shader in the older version of shader graph if it doesn't work out of the box). So those are the only limitations that comes to mind.
When you say you can change it to hexagon in @7:15, it would be so much better to watch if you click it just to show the viewer what changes if you do that.
I`m trying to adapt your lecture for 2D Unity System. This lecture is so perfect for me and your last explanation for pivot makes me know why my tilemap dislocated little. Thank you. Let me ask you one more question... I think I can alternate Grid Component to Tilemap Component because we usually use it in 2D unity, and it is OK until but... do you think is there potential problems?
Hey! Tilemap in unity either inherits or uses grid component. I think it uses it because you get the grid component added whenever you create a tilemap. I think you can use either one.
Thanks a lot for this Peter. I really want a grid building system for my tank game (actually using your tutorial for that too). I want to reimagine the game Bolo on the Apple II.
Hey! Right now (this channel) is Unity focused. I want to do something similar for Godot in the near future. No plans for other engines though 🙂 BTW many people have mentioned that some of the Procedural generation tutorials of mine are easily portable to Unreal engine. Code logic / architecture can easily be reused between engines. Things like Unity specific components (like the Grid component here) might be harder to translate though.
Thanks for this awesome tutorial! but I have question, I had already watched all of the series. when I place the object with say 3x2, cursor (that take first grid with mouse cursor) already aligned with grid that has placement layer mask. But for the rest generated cursor still can place outside the grid boundaries how can I fix this or am I missing something?
You mean you would like to add Bounds to the placement area? I cover it in my paid project. Basically you need to check if each tile that your 3x2 area requires for placement is inside the bounds that you define. I do this check when we move the cursor and update the preview. Again I don't cover this in my free implementation. Sorry
Hi, when I import the project assets (i only import the ones needed for the prefabs) the "CursorIndicatorParent" only shows as a opaque blank white square. It doesnt have the transparent hole in the center it does like yours. I am using Unity 2022.3.0. Can u help me? Otherwise, fantastic tutorial!
Maybe you have to set the "Render Mode" to be Transparent in the Material for the Cursor object docs.unity3d.com/Manual/StandardShaderMaterialParameterAlbedoColor.html
@@SunnyValleyStudio Ti sto seguendo ora e se permetti provo a aiutare riguardo alla domanda anche se nella mia lingua. Seleziona il materiale cellIndicator, in alto a destra cambia lo shader in standard. A questo punto doce c'è albedo ci metti lo sprite GridInidcator che trovi nella cartella _content. Fatto ciò basta che rimetti lo shader in sprites/default e dovresti visualizzare perbene. Ottimo video
Hello, I am having issues with the grid being unaligned and unaffected by any changes to dragging the GridParent around. I am using the Voxel Generator tutorial you made and trying to implement this building grid system in a 3D world. I tried to follow along perfectly (swapping the floor grid indicator for a 3D visual model) but the closest i ever got to a functional (somewhat buggy) 3D grid is this: private void Update() { Vector3 mousePosition = inputManager.GetSelectedMapPosition(); Vector3 gridPosition = new Vector3(Mathf.Round(mousePosition.x), Mathf.Round(mousePosition.y), Mathf.Round(mousePosition.z)); mouseIndicator.transform.position = mousePosition; cellIndicator.transform.position = gridPosition; } With the GridParent Transformed to -.5 on XYZ. Depending on the face of the voxel, it either works correctly or places the grid cursor in the air beside the target block. Any help to my confusion is appreciated!
I am not sure but it might be but remember that the Grid component has center points in the bottom-left corner (at least in 2D). Maybe it is a matter of math - that in the voxel generator the center point is in the middle of the voxel. Maybe just adding an offset of -.5 to x and z by default would fix that? The error sounds like a floating point issue where since it it is on the edge of 2 grid tiles it sometimes works and sometimes doesn't, Still might be some more complex problem.
Grid component works in 2D (it is used for Tilemaps). You could use the same system but your input would probably be just mouse position (no need to raycast anymore)
@@SunnyValleyStudio enway I'm sure I bulding editor like I will be able to be useful for other type off game's well. It will be easy to make Sothis like this as map editor for game. Or a one off the tools for sandbox game.
Am I required to purchase the course to get the prefabs shown in this course? Should I find alternative assets or is there somewhere I can download them?
Hey! I always reference the assets used in the description "Assets used: kenney.nl/" . Just search for Furniture Kit there. I will edit the link to point to it directly 👍 If you like the project and want to support me feel free to grab the paid version 🙂
As far as I recall we have used a simple quad with a texture to create preview system. You can modify the texture or create the outline using a shader to be able to smoothly modify how it looks.
Hey! You can check the code here (as I suspect it might be a matter of some missing line of code) github.com/SunnyValleyStudio/Grid-Placement-System-Unity-2022/commit/10d004fefbbac0dcbea0022a53b4ce3ba9c6da89 Also make sure to set the LayerMask of the cell indicator to something other than default as in the code we want to be detecting the ground. I mention it at 5:25 I hope it helps!
It is best to download the full project (ZIP filed), unpack it to a separate folder and use unity Hub "open" on it to add open the same project as I have. The scene should be in the "Scenes" folder. Sorry for not explaining it better!
It depends. If you mean 3D like Minecraft you could have a grid that stores x,y,z and when walking shoot calculate the position in front of the player and clamp it to the closest grid position. The core system would work the same as here.
I have been having this issue where on one side of the plane the grid snaps all the way to the edge and on the other side it only snaps one early. This makes it so on one side it goes outside of the plane. I have been trying to offset things like crazy. The grid, the plane, the gridparent. I even tested with the sphere as grid indicator and still it indicates that it reaches the edge of the plane on one side but not on the other side. I also have tried scaling but just no change works. I am completely lost on why my grid is completely incorrect.
So remember how we convert the world position to grid position? Check using Debug.log what is the world position and what the grid position is. It might be that the grid has an offset and when you reach one of the edges the position is Ceiled (rounded up) ? Also remember that we have the grid plane and the ground plane (for simplicity of the setup). The problem might be that one is smaller than the other and when detecting positions on the edge there is actually no collider so the raycast is NULL and the returned position is from the previous row / column. This actually happened to me so maybe that is also an issue in your case?
@@SunnyValleyStudio thank you but I already figured it out. I noticed that it qas working correctly however by default it took the bottem left corner of the grid right on the crossing point. So all I had to do was add an offset in code of 0.5f X and 0.5f Z that put it in the center of the square and fixed it. Before that I was trying to do the offset in unity but ofcoarse that gets reset by the code. But thank you for your response I deeply appreciate the efford you put un to help everyone.
Somehow when i follow this tutorial, the sphere (mousepointer) starts where the mouse is, but then flies straight to the camera, and i can't figure out why. Strange
Have you set the Spheres layer to something other than "default" ? I might have gone over this too fast. Basically if sphere has the same layer as the detection layer the sphere will be gradually moving towards the detected point - which is on the surface of the sphere. This will cause it to fly towards the camera. Sorry for not explaining it better in the video!
@@SunnyValleyStudio Yes, problem with the layers. instead in changing the layer i added it so, I had the problem you describe above. Thanks for answering
I'd like to do something similar in 2d but I'm having some trouble with the input manager. The z index of the circle I'm using as a mouse indicator is at -6.58 even though my near clipping on the camera is set to 0 (started with 0.001) and it's not following the mouse position either (based on inspector values). Any ideas why and what I could do to fix it?
In 2D you actually don't need the Camera Raycast. You would use "Camera.main.ScreenToWorldPoint(Input.mousePosition);" Next you would use that to move your Image (since in 2d we don't use spheres 🙂 unless you know what you are doing) and set it as spheres x and y position. Hope it makes sense! If you are using the new input system you just need to get the mosuPosition from that 🙂
Well usually the grid is flat (even if the space includes a mountain it should not take more space than another cell in your grid) - so unless you want an irregular grid the only problem is placing the objects or drawing the grid in accordance with the vertices of the mesh. I am not really sure how our shader would work - I assume that it would handle it. In that case all you would need is to adjust the placement position so that the object aligns with the ground. I hope it helps somehow. I haven't tested this system with an uneven ground (like in civilization series) *for an irregular grid you would need a custom grid script
Part 2 about grid visualization -> ua-cam.com/video/nKF4Pwb-6Ow/v-deo.html
I love your passion for what the majority see as impossibly dull! I code for a living and for a hobby! Just trying to learn Unity now! 🙂
Thanks ! 🙂
You got great pacing. Enough details for me to learn, but not too much detail to get bored. I enjoyed watching this. Thanks 👍
I'm glad that you like it and I really appreciate your comment 🙂
This might be, hands down, the best tutorial I've ever seen in my life. Not even joking, you have too much talent!
Thanks! 😃
I've never thought to use the Unity Grid component all this long... seems very useful now
Thanks for the comment!
I wasn't having much luck finding good examples of using Unity's Grid class and along comes your tutorial - yay! Thank you so much.
Glad it was helpful! 👍
@@SunnyValleyStudio can you please share the starter project link
Thank you! I'm not a native british or american, but i understood all frazes or words. My english level not low, and not high.
The most best part of your tutorial is code. U make code so easy that hard to didn't undrestand what happen in video.
One more - Thank you! +rep
Thanks for the comment!
This is extremely useful. I've been trying to get started on a base-building game and what I want to accomplish first is to make it possible to plop down objects (buildings) of various dimensions (1x1, 2x3) on a grid. So I'm looking forward to the rest of the series. Thanks!
Awesome! I will be posting the remining parts this week.
@@SunnyValleyStudio can you please share the starter project link
Really useful, been trying to follow one of these and have not had much luck, so far this one is great!
Great to hear! Thanks for watching 🙂
To anyone having trouble with the Mouse Indicator Testing part, make sure you have a mesh collider on the plane you are using as your grid.
Also, to anyone having trouble with the Cursor Indicator not aligning with the cursor, make sure it has the correct Y position as it is different in the game than in the scene viewport. Spend time to make sure it is perfectly level in the game when you hit play (it doesn't matter if it is below the plane in the scene mode).
Thanks for sharing! 👍
Thanks a lot, really simple and straight forward. used prebuild unity components with a really simple logic. Thanks a lot brother
Thanks!🙂
SUCH an amazing set of tutorials and like other people have also said; exactly what i was looking for. thank you so much !
Thanks so much!🙂
Great straight forward tutorial! Love the stuff! :)
Awesome! Thanks for the comment 😍
Fantastic tutorial! Exactly the kinds of things I was hoping to learn
Glad to hear it! 🙂
Thank you - again...
Great work and alyways exactly what I'm looking for.
As soon as I (or if I ever) earn some money with my Games, I will support you financially as well.
Thanks. And be sure to focused on making games first 👍 Making money from games is kind of separate skill and I don't think it is easy to learn it and make games at the same time 🙂
really excited to watch it, thanks for the great tutorials!!
Thanks!
Hey Peter, thanks for this tutorial! Grid system is something i’ve had trouble with in the past, so I’m looking forward to learning how to implement this
I hope that my tutorial will help 🙂
@@SunnyValleyStudio can you please share the starter project link
Great vid. By the way this creator also has courses on Udemy. Several of the courses are great for people who have got the fundamentals of Unity and coding under their belt and need to start learning architecture, design patterns and internal testing.
Thanks for watching!
Thanks! I like this to the point style of teaching that you do.
Glad to hear that! 👍
Really great and clear strait forward explanation!
Thanks for watching 👍
Thank you for making this tutorial, it is really helpful to me
You're welcome 😊
Thanks! Using this in a Game Jam build right now :D
Awesome! Let me know how it went! 🙂
Nice tutorial, very well explained!
Glad it was helpful! 👍
Great stuff as always. Exactly what I was looking for.
Thanks 👍
A very clear and entertaining video.
Glad you enjoyed it!
its a good start for my ideas, thanks!
Good to hear that! 👍🙂
Thank's man. That just what I've been looking for
Awesome! 🙂
Thank you very much! You teaching skills are awesome!
Thanks for watching 🙂
❤ Thanks Peter, this tutorial is fantastic, It helped a lot!
Glad it helped! 👍
@@SunnyValleyStudio can you please share the starter project link
Thanks for the tutorial but where is the project you mentioned at the start of the video?
If you mean the extended version you can find it here courses.sunnyvalleystudio.com/ . Thanks for your support! 😍
thanks a lot !!! i always learn when watching you tutorials. I really enjoy your udemy courses.
I really appreciate that! Thanks for watching 🙂
awsome tutorial... thanks for your clear explanations
Glad it was helpful! 👍
Your videos are amazing please share more video 😊😊😊😊😊😊😊😊
Thanks for watching 🙂
Thanks for the tutorial looking for something like this....
Great to hear! Thanks for watching 🙂
This Video helped me a lot! Thank you!
Thank you!
Just what the doctor ordered! I can't wait to use this in the game. I'll definitely be buying your course. One question: my game is currently using Unity 2021. Is it a must to upgrade to 2022?
As long as you are using Unity 2021.2 and above there should be no issues. This is because I am using C#9 features docs.unity3d.com/2021.2/Documentation/Manual/CSharpCompiler.html
I am not sure about the shader part since this changes a lot (we are using a shader graph). But its something that you can convert easily - well you would recreate the shader in the older version of shader graph if it doesn't work out of the box).
So those are the only limitations that comes to mind.
When you say you can change it to hexagon in @7:15, it would be so much better to watch if you click it just to show the viewer what changes if you do that.
Thanks for the feedback! 👍
@@SunnyValleyStudio Hey, you have great content man. Your subs are criminally underrated.
You doing good job via tutorials. Glad to watch it :)
Glad you like them!
@@SunnyValleyStudio can you please share the starter project link
amazing and easy tutorials
Thanks for watching! 👍
thank you sunny, amazing tuts
Thanks for watching 🙂
Hi, your guide is very useful, but can you tell me how to create a Coursorindicator prefab?
Thank you for the great tutorial!
Thanks for watching 🙂
You are my savior !!! Thanks for the video
Thanks for watching 🙂
These are great tutorials, always love your content :)
Thanks a lot 🙂
I`m trying to adapt your lecture for 2D Unity System. This lecture is so perfect for me and your last explanation for pivot makes me know why my tilemap dislocated little. Thank you. Let me ask you one more question... I think I can alternate Grid Component to Tilemap Component because we usually use it in 2D unity, and it is OK until but... do you think is there potential problems?
Hey! Tilemap in unity either inherits or uses grid component. I think it uses it because you get the grid component added whenever you create a tilemap. I think you can use either one.
Thanks a lot for this Peter. I really want a grid building system for my tank game (actually using your tutorial for that too). I want to reimagine the game Bolo on the Apple II.
Sounds awesome! Be sure to share your progress on SVS discord (link in every video) 🙂
@@SunnyValleyStudio can you please share the starter project link
esse curso me ajuda muito com meus estudos, obrigado!
Thanks for witching 🙂
This is wonderful tutorial! Thank you!!
Thanks for watching 🙂
@@SunnyValleyStudio can you please share the starter project link
That's a good tutorial. Do you make guides for different engines or it's an Unity-focused channel??
Hey!
Right now (this channel) is Unity focused. I want to do something similar for Godot in the near future. No plans for other engines though 🙂
BTW many people have mentioned that some of the Procedural generation tutorials of mine are easily portable to Unreal engine. Code logic / architecture can easily be reused between engines. Things like Unity specific components (like the Grid component here) might be harder to translate though.
really helpful video, thanks
Thanks for watching!
Thank you Peter !
Thanks for watching 🙂
Just Amazing Sir
Thanks a lot!
nice tutorial thank you
Glad it was helpful! 👍
Maybe you have tutorial on generating a house based on outlines on a satellite map. So that users can draw the shape of their house and apply extrude
Not yet! Sorry 🙂
@@SunnyValleyStudio, thank you for your response
thanks awesome tutorial
Thanks for witching! 👍
Thanks! super easy to understand👍
Glad to hear that! 👍
really helpful video
Glad you think so! 🙂
You wonderful man. Thank you very much.
Thanks 👍
Thanks for the video :)
Thanks for watching!
After this tutorial I'll be a phucking billionare!
감사합니다.
시청해 주셔서 감사합니다.
Thanks for this awesome tutorial!
but I have question, I had already watched all of the series. when I place the object with say 3x2, cursor (that take first grid with mouse cursor) already aligned with grid that has placement layer mask. But for the rest generated cursor still can place outside the grid boundaries
how can I fix this or am I missing something?
You mean you would like to add Bounds to the placement area? I cover it in my paid project. Basically you need to check if each tile that your 3x2 area requires for placement is inside the bounds that you define. I do this check when we move the cursor and update the preview. Again I don't cover this in my free implementation. Sorry
@@SunnyValleyStudio it's okay
again thanks for sharing :D
Nice, Thanks!
🙂
Hi, when I import the project assets (i only import the ones needed for the prefabs) the "CursorIndicatorParent" only shows as a opaque blank white square. It doesnt have the transparent hole in the center it does like yours. I am using Unity 2022.3.0. Can u help me? Otherwise, fantastic tutorial!
Maybe you have to set the "Render Mode" to be Transparent in the Material for the Cursor object docs.unity3d.com/Manual/StandardShaderMaterialParameterAlbedoColor.html
@@SunnyValleyStudio
Ti sto seguendo ora e se permetti provo a aiutare riguardo alla domanda anche se nella mia lingua.
Seleziona il materiale cellIndicator, in alto a destra cambia lo shader in standard. A questo punto doce c'è albedo ci metti lo sprite GridInidcator che trovi nella cartella _content. Fatto ciò basta che rimetti lo shader in sprites/default e dovresti visualizzare perbene. Ottimo video
Great Video!
Thanks!
thank you sooooo much big brother
Thanks for watching!
Hello, I am having issues with the grid being unaligned and unaffected by any changes to dragging the GridParent around. I am using the Voxel Generator tutorial you made and trying to implement this building grid system in a 3D world. I tried to follow along perfectly (swapping the floor grid indicator for a 3D visual model) but the closest i ever got to a functional (somewhat buggy) 3D grid is this:
private void Update()
{
Vector3 mousePosition = inputManager.GetSelectedMapPosition();
Vector3 gridPosition = new Vector3(Mathf.Round(mousePosition.x), Mathf.Round(mousePosition.y), Mathf.Round(mousePosition.z));
mouseIndicator.transform.position = mousePosition;
cellIndicator.transform.position = gridPosition;
}
With the GridParent Transformed to -.5 on XYZ. Depending on the face of the voxel, it either works correctly or places the grid cursor in the air beside the target block. Any help to my confusion is appreciated!
I am not sure but it might be but remember that the Grid component has center points in the bottom-left corner (at least in 2D). Maybe it is a matter of math - that in the voxel generator the center point is in the middle of the voxel. Maybe just adding an offset of -.5 to x and z by default would fix that?
The error sounds like a floating point issue where since it it is on the edge of 2 grid tiles it sometimes works and sometimes doesn't, Still might be some more complex problem.
cool and thanks~~ looks better and better~
Thanks for watching 🙂
Thanks!
Thanks for watching!
would this tutorial work with 2d as well but i just have to change some things to fit 2d?
Grid component works in 2D (it is used for Tilemaps). You could use the same system but your input would probably be just mouse position (no need to raycast anymore)
Great video)
Thanks!
This remindmy Sims
11:45 especially this part
Awesome! I hoped it would 🙂 (otherwise I don't think people would watch the tutorial that much 😅)
@@SunnyValleyStudio enway I'm sure I bulding editor like I will be able to be useful for other type off game's well.
It will be easy to make Sothis like this as map editor for game.
Or a one off the tools for sandbox game.
Love it.✌
Thanks for watching 🙂
thanks
Thanks for watching!
Am I required to purchase the course to get the prefabs shown in this course? Should I find alternative assets or is there somewhere I can download them?
Hey! I always reference the assets used in the description "Assets used: kenney.nl/" . Just search for Furniture Kit there. I will edit the link to point to it directly 👍
If you like the project and want to support me feel free to grab the paid version 🙂
thanks man
Thanks for watching 🙂
thanks!
Glad you like it 🙂
Thanks!
Thanks for watching!
I like cheese burger and your lesson tastes very cheese burger.
That is the most creative comment that I had on the channel 😄
thanks
Thanks for watching 🙂
Great vidio
Thanks for watching! 🙂
Gracias!
Thanks for watching! 🙂
good stuff comment
Thanks!
How do i change the width of that white part of the Coursor Indicator.
As far as I recall we have used a simple quad with a texture to create preview system. You can modify the texture or create the outline using a shader to be able to smoothly modify how it looks.
sir cell indecator not working And download the assets from said?
Hey!
You can check the code here (as I suspect it might be a matter of some missing line of code) github.com/SunnyValleyStudio/Grid-Placement-System-Unity-2022/commit/10d004fefbbac0dcbea0022a53b4ce3ba9c6da89
Also make sure to set the LayerMask of the cell indicator to something other than default as in the code we want to be detecting the ground. I mention it at 5:25
I hope it helps!
ty
Thanks for watching! 🙂
thnks
Thanks for watching!
I creating project in 3d URP but i haven't this folders and scenes as you.
Pls help!
It is best to download the full project (ZIP filed), unpack it to a separate folder and use unity Hub "open" on it to add open the same project as I have.
The scene should be in the "Scenes" folder. Sorry for not explaining it better!
@@SunnyValleyStudio thanks
this same for 3d game??
It depends. If you mean 3D like Minecraft you could have a grid that stores x,y,z and when walking shoot calculate the position in front of the player and clamp it to the closest grid position. The core system would work the same as here.
I have been having this issue where on one side of the plane the grid snaps all the way to the edge and on the other side it only snaps one early. This makes it so on one side it goes outside of the plane. I have been trying to offset things like crazy. The grid, the plane, the gridparent. I even tested with the sphere as grid indicator and still it indicates that it reaches the edge of the plane on one side but not on the other side. I also have tried scaling but just no change works. I am completely lost on why my grid is completely incorrect.
So remember how we convert the world position to grid position? Check using Debug.log what is the world position and what the grid position is. It might be that the grid has an offset and when you reach one of the edges the position is Ceiled (rounded up) ?
Also remember that we have the grid plane and the ground plane (for simplicity of the setup). The problem might be that one is smaller than the other and when detecting positions on the edge there is actually no collider so the raycast is NULL and the returned position is from the previous row / column. This actually happened to me so maybe that is also an issue in your case?
@@SunnyValleyStudio thank you but I already figured it out. I noticed that it qas working correctly however by default it took the bottem left corner of the grid right on the crossing point. So all I had to do was add an offset in code of 0.5f X and 0.5f Z that put it in the center of the square and fixed it. Before that I was trying to do the offset in unity but ofcoarse that gets reset by the code. But thank you for your response I deeply appreciate the efford you put un to help everyone.
does this system work with controllers too?
If you are using the new input system you could use the controller as well 👍
Thanks nice one
Glad to hear it!
THX!
Thanks for watching! 🙂
Thanks :)
Thanks for watching! 👍
Thanks!!!
Thanks for watching 🙂
Somehow when i follow this tutorial, the sphere (mousepointer) starts where the mouse is, but then flies straight to the camera, and i can't figure out why. Strange
Have you set the Spheres layer to something other than "default" ? I might have gone over this too fast. Basically if sphere has the same layer as the detection layer the sphere will be gradually moving towards the detected point - which is on the surface of the sphere. This will cause it to fly towards the camera.
Sorry for not explaining it better in the video!
@@SunnyValleyStudio Yes, problem with the layers. instead in changing the layer i added it so, I had the problem you describe above. Thanks for answering
Is there a tutorial to do this in a 2D based game?
Sorry not yet 🙂
I'd like to do something similar in 2d but I'm having some trouble with the input manager. The z index of the circle I'm using as a mouse indicator is at -6.58 even though my near clipping on the camera is set to 0 (started with 0.001) and it's not following the mouse position either (based on inspector values). Any ideas why and what I could do to fix it?
In 2D you actually don't need the Camera Raycast. You would use "Camera.main.ScreenToWorldPoint(Input.mousePosition);"
Next you would use that to move your Image (since in 2d we don't use spheres 🙂 unless you know what you are doing) and set it as spheres x and y position. Hope it makes sense!
If you are using the new input system you just need to get the mosuPosition from that 🙂
Thanks for the response! I tried it without the raycast and it worked out perfectly
Does this apply to uneven ground?
Well usually the grid is flat (even if the space includes a mountain it should not take more space than another cell in your grid) - so unless you want an irregular grid the only problem is placing the objects or drawing the grid in accordance with the vertices of the mesh. I am not really sure how our shader would work - I assume that it would handle it. In that case all you would need is to adjust the placement position so that the object aligns with the ground.
I hope it helps somehow. I haven't tested this system with an uneven ground (like in civilization series)
*for an irregular grid you would need a custom grid script
Great!
Thanks!