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. Dismiss Notice

Isometric-like 3d

Discussion in 'Editor & General Support' started by Atheran, Nov 14, 2014.

  1. Atheran

    Atheran

    Joined:
    Nov 13, 2014
    Posts:
    6
    Hello there, this is my second post in the forums and one of the very few occasions that I use forums in general, so I'm a bit out of my league here. If this is the wrong place to post my questions I'm sorry, it was not intentional.

    A little bit of what I'm trying to do here so I set a background to better understand my questions.

    I'm trying to create yet another survival game for PC. Growing up I came to love the isometric games I played. Things like Fallout 1,2/Baldurs Gate 1,2/Icewind Dale etc etc. That's the effect I'm trying to achieve here but using 3d graphics instead of sprites. Eventually I want to make a survival game with isometric feel on the camera, random world gen (using tiles probably) with no mosters/mutants/zombies/aliens but with humans. As close to a Post-Apocalyptic simulator of some sort. I had way more ideas about it but I'm not even sure if they are doable at all so I leave them out for now.

    As of now after 3 or so hours of work on it, I started having my first problems with the camera.

    Problem 1) Whenever I put it in orthographic mode it ignores my rotation settings and turns to top-down instead of the bird-eye view I want to achieve. I simply ignored that problem, left it on perspective with 30/45 rotation and as of now I'm quite happy with the result. It might not be pure isometric as I have perspective in my view but I'm npt sure that this is a bad thing. I'll have to see how it looks when I get my environment in place. For now I have a nice view of my character and that's fine with me.

    After that I made a couple of scripts for character/camera movement. Character moves on mouse click fine and the camera follows the character of x/z axis without changing the set rotation or distance from the character.

    Now the problems and questions begin.

    Problem 2) Character collision works but whenever the character is behind a wall or something, he's not visible and that's normal. Well... I don't want that. I want to achieve an effect like it had in Fallout 1/2 for example where the wall disappeared for as long as the character was behind it. I imagine I could do that by turning off wall rendering whenever it is between the character and the camera, but this would get rid of off the whole wall segment. What I want to do is that there's a "hole" in the wall at the place where the character model would normally render. Hopefully with a "fade-out" effect (from 100% wall opacity to 10-15% opacity with a smooth transition).

    Problem 3) Camera rotation. I want to achieve an effect of camera rotating similar to the xcom series where you press q/e and the camera rotates for 45 degress left or right respectively around the character keeping the elevation it had. At first I thought to make the camera child of the character but that creates a ton of problems for me. First of all it follows the character's rotation which I do NOT want and it won't be independent so the player won't be able to use WASD to move the camera around which is something I want to implement later on.

    Problem 4) Fog of War. After I implement the independent WASD camera movement I want to add fog of war mechanics. I've seen several plugins and tutorials about it but none does what I want, or is even close to what I want. First of all I want it to be like a thick grey/black fog that covers everything and not simply a circle around my character where things get rendered and outside of that circle there's infinite blackness. I also want it to not apply on the places where the character has visited before (so they're visible but probably greyed out) and I want it to have Field of View attached to it, so for example the character can't clearly see behind him or behind an object in his fov. Kind of how fov works on Zomboid.

    These are the problems I want to tackle for my main camera before I continue on developing game mechanics. After those are fixed I'll ask again for any other problems I might have in this thread (hence the general title) so I don't spam the forums.

    I'm not a programer (although I know my programing to some extend), I'm a 3d artist so please try to explain if heavy coding is needed. I do NOT want people to simply post scripts here, as I'm never going to learn that way. I'd prefer links to tutorials if they exist, or ideas on how I tackle those problems if tutorials do not exist. If you post scripts I'm not against it but I'd really like you to also explain why that script works or what it does, so I get a grasp of what is needed to be done and then do it myself. This is a learning experience for me.

    For now I use Unity free and C#. If buying the pro edition is the only way to achieve such things I might consider it but my budget is pretty limited this period so I'd try to avoid it for now. And I'd prefer to keep coding in C# as it's way closer to what I'm used to in programming. I don't want to learn javescript from scratch for that.

    Thanks in advance for the replies and sorry for this wall of text (as stated forums is not my thing).
     
  2. Not_Sure

    Not_Sure

    Joined:
    Dec 13, 2011
    Posts:
    3,541
    I'll try and help best I can.

    Problem 1) It sounds like you're misinterprating what the camera's aiming at. I could be wrong, but when I've had similar issues it was because the camera was misplaced. Try fiddling with the angels and location. The camera will draw a box that represents the start point of where it is rendering, then moves outward.

    Problem 2) What you're talking about is a technique that was easy to do with 2d game (draw an alpha/transparent area on 2d sprites). You don't see that too often because it gets a little tricky in 3d and if you did do it, I think you would need draw to texture (pro only) and a second camera.

    What you can do is draw a ray between the player and the camera that turns off render on the object (like you mentioned), or alter the transparency of the material.

    Or, you could also use a renderer to show the player behind objects.

    Or lastly I would simply extending the collision boxes behind objects so that the player is always visible. But that might not work considering that you want to rotate the camera.

    Problem 3) I would highly suggest not rotating the camera at all as it A) makes getting around more confusing, and B) it means that you'd need to draw twice as much on structures (you don't need to draw the back of a tavern if you can't see it).

    However, if your game demands it, what you want to do is make an empty object. Parent it to the camera. Set the empty object on your player (do not rotate it, just move the position). Then get you camera set up by selecting the camera child inside the empty object and adjusting it in the inspector tab (the values are referenced to the empty object now, and not the world). Finally, add a script to the empty that changes its rotation.

    Problem 4) I really haven't tried anything like that so I'm not 100% certain.


    Hope this helps.
     
  3. Atheran

    Atheran

    Joined:
    Nov 13, 2014
    Posts:
    6
    Thanks for the reply... For the second problem the reason I don't want to turn off the renderer to the object is because the size of the object is unknown. I wouldn't want to turn an entire fence line off for example. And while changing the transparency is less brutal to the eye of the player the problem stays the same. In small objects like a table for example changing the transparency would work perfectly. If I do that I have to do it for the entire object or can I do it for parts of it only? I guess that for doing it for part of the object only I'd need an alpha texture to be placed on top of the object's texture at the place the character is at. Is that what you say I need the pro version for?
     
  4. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    958
    It's actually possible to write an halo shader for this but whether it's practical or not depends on the exact use, whether you expect more than the player object to cause it to go transparent or not and what the target platform is (ie. you can get away with a lot of stuff on the desktop).
     
  5. Atheran

    Atheran

    Joined:
    Nov 13, 2014
    Posts:
    6
    Yes it is for desktop only, at least for now and yes only the player will make it go off.