- Home /
Transform Position, add plus 5
I have this code:
 using UnityEngine;
 
 using System.Collections;
 
 
 
 public class GunParentScript : MonoBehaviour {
 
     
 
     private Camera myCamera;
 
     private Transform GunTransform;
 
     
 
     // Use this for initialization
 
     void Start () {
 
         
 
         if(networkView.isMine == true){
 
             
 
             myCamera = Camera.main;
 
             GunTransform = transform.FindChild("Gun");
 
             
 
         }else{
 
             
 
             enabled = false;
 
             
 
         }
 
         
 
         
 
     }
 
     
 
     // Update is called once per frame
 
     void Update () {
 
         
 
         myCamera.transform.position = GunTransform.position;
 
         myCamera.transform.rotation = GunTransform.rotation;
 
         
 
     }
 
 }
But I want the (myCamera.transform.position = GunTransform.position;) -> at the update function to add like 5 to it.
I think this is what the position meanse: 0,0,0 and I wan't it to be 0,0,5. Its just a example but that's it actualy
I tried myCamera.transform.position = GunTransform.position + 5; but that didn't work.
Thanks Alot!
matijs
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by PAEvenson · Dec 26, 2012 at 08:01 PM
maybe
  myCamera.transform.position = GunTransform.position + new Vector3(0.0f, 0.0f 5.0f);
Your answer
 
 
             Follow this Question
Related Questions
What is the reasoning of multiplying by Time.deltaTime 1 Answer
does not work check if dead 1 Answer
Help around an approach to a "Virtual Motion Table" in Unity 0 Answers
Instantiated prefab position 5 Answers
Setting Position of Spawned Prefab 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                