need to be able to do these things and control the camera in play mode and also enable collision between the camera and building. any help will be appreciated
The scene should start with a camera in it. Add a capsule collider to it & either add a character controller or write your own script for the movement. Adding a rigidbody is a decision you will need to make.
Otherwise create a character & child the camera to it.
can you point me to a good tutorial?
Hey mivitz,
Question, why are you using Unity 4 and not the latest? I only ask because I’ve only used the latest and not sure if what I’m going to suggest will work in 4…
Basically I’ve learned this from some of the tutorials (Merry fragmas and merry fragmas 2.0 - can link if you want. 2.0 needs 5… I think). What you can do is go to the asset store, search for “Standard Assets” by Unity Technologies, then download and import the “Characters->FirstPersonCharacter->Prefabs->FPSController”. I DON’T know what the dependencies are so perhaps setup a new project to test in!
Then drag FPS controller into your scene (with a plane+collider for ground!) and run. If it works, open the script and Reverse engineer it.
As for writing your own… not to sure as I haven’t gotten round to making one myself… probably probe for mouse axes in input, the rotate camera accordingly. Input of “W” and “S” adjusts transform along transform.forward and -transform.forward respectively… this is off the top of my head, so please don’t take this as gospel, lol.
P.S. Here are the Merry Fragmas tutorials.
(Tested on 4.6)
http://unity3d.com/learn/tutorials/modules/intermediate/live-training-archive/merry-fragmas-multiplayer-fps
(Tested on 5.3)
https://unity3d.com/learn/tutorials/modules/intermediate/live-training-archive/fragmas-2-multiplayer-fps
Start with the official unity tutorials using the learn link above. They start with simple things & explain how & why to do stuff the right way.