Use the mouse to aim? I want to do as Shooting in this game: http://www.hrajuhry.cz/strilecky/hra/outposthaven#hra (sorry for my english, i am from the Czech republic and google translator is really bad )
Just insert in a first person controller. Attach your firearm prefab to the main camera.
Assuming:
- Top down view
- Camera parallel to the XZ plane
- Model built so that โforwardโ is facing positive โZโ when rotation is (0,0,0)
Something like this will work:
#pragma strict
function Update() {
var pos = Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.main.transform.position.y - transform.position.y);
pos = camera.main.ScreenToWorldPoint(pos);
var aimingDirection = pos - transform.position;
transform.rotation = Quaternion.LookRotation(aimingDirection);
}