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

GTA Type camera which do not go through walls

Discussion in 'General Discussion' started by Yash987654321, Feb 28, 2015.

  1. Yash987654321

    Yash987654321

    Joined:
    Oct 22, 2014
    Posts:
    729
    A GTA Type camera free
     
  2. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,353
    Bro, do you even Google?
     
    Not_Sure and GarBenjamin like this.
  3. Yash987654321

    Yash987654321

    Joined:
    Oct 22, 2014
    Posts:
    729
    Do u think so first one not working. I wanted C# slow net for seeing videos and...........
     
  4. Yash987654321

    Yash987654321

    Joined:
    Oct 22, 2014
    Posts:
    729
    another question how to bounce a sword when it hit an object
    :)
     
  5. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,353
    Change its Physics Material to "Bouncy"
     
    Ryiah likes this.
  6. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,353
    What?
     
  7. Deon-Cadme

    Deon-Cadme

    Joined:
    Sep 10, 2013
    Posts:
    288
    @Yash987654321 - You want to google c#, 3rd person camera, camera collision and things like that.

    I haven't played any 3d GTA for ages so I don't remember the exact camera behavior but...

    Assuming that you have a "normal" level made out of several meshes with collision... the basic solution is fairly simple. You define a minimum distance that you want the camera to keep from objects. Then throw rays in every direction and check if they hit something, if they do, check the distance between the object and camera. Move the camera closer to the character if the distance is smaller then the minimum distance that you defined earlier.

    Another method would be to add a collision mesh that surrounds the camera and use the collision to detect when it gets too close to stuff.

    There is no guarantee that you won't clip into things, a tight space filled with detailed meshes is always a pain to handle.

    The benefit with the ray casting method is that you can play around with the number of rays that you use. You can also use the results from the rays to create even more advanced behavior where you do not always move the camera closer to the character horizontally, vertically or even do more advanced things.
     
    Ryiah likes this.
  8. Not_Sure

    Not_Sure

    Joined:
    Dec 13, 2011
    Posts:
    3,541
    It sounds like you may be getting ahead of yourself. Maybe try some more tutorials first.
     
  9. Yash987654321

    Yash987654321

    Joined:
    Oct 22, 2014
    Posts:
    729
    aren't there and assets or well commented script which i can experiment with as whatever i learnt till now is with this way only...
     
  10. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,353
    First learn how to program( I would recommend C#) and then learn how to use Unity's APIs. Then finally you'll be able to make your own script without anyone's help.
    As right now if you get your hands on a script, no matter how well commented it is you won't get a thing. Maybe changing the code a bit will help, but not much.
     
  11. Deon-Cadme

    Deon-Cadme

    Joined:
    Sep 10, 2013
    Posts:
    288
    @Yash987654321 - Yes, there is probably a hundred scripts like this lying around the internet if you Google for them but that isn't my job ;) If they are well commented... well... that is a completely different question... Try search queries like; unity 3rd person camera collision. Just remember that the solutions you find was probably written for a very specific case and might contain code that isn't suitable for you.
     
  12. Yash987654321

    Yash987654321

    Joined:
    Oct 22, 2014
    Posts:
    729
    I know both JavaScript and C# I don't say i am a master at them but i know them.