ok instead of opening another question how do i make the initiated object follow the rotationg as well? also how do i get it to work with scroll wheel if anyone can help me
var player : Transform;
var ActualPlacedPeice : Transform;
function Start()
{
//transform.eulerAngles.y = 0;
player = GameObject.Find("Player").transform;
}
function Update ()
{
var pos = player.position + player.forward * 5.0;
transform.position = pos + Vector3.up;// * 0.5;
transform.rotation = Quaternion.LookRotation(player.transform.forward);
var hit : RaycastHit;
if (Physics.Raycast(transform.position, Vector3.down, hit))
{
transform.position = hit.point + Vector3.up * 0.5;
}
if (Input.GetButtonDown("Fire1"))
{
Instantiate(ActualPlacedPeice,transform.position, transform.rotation);
}
if (Input.GetButton("Fire2"))
{
// transform.eulerAngles.y += 90;
transform.Rotate(0,90,0);
}
}