Author Topic: check if object is mine  (Read 2123 times)

sloopernine

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 47
    • View Profile
check if object is mine
« on: July 07, 2013, 05:51:58 PM »
I know I can use tno.isMine to check the object the script is attached to. But is there a way to check if "target" object is mine?

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class test : MonoBehaviour {
  5.        
  6.         public Transform target;
  7.        
  8.         public float objPosX;
  9.         public float objPosY;
  10.         public float objPosZ;
  11.        
  12.         public float objAngleX;
  13.         public float objAngleY;
  14.         public float objAngleZ;
  15.        
  16.         // Use this for initialization.
  17.         void Start ()
  18.         {
  19.                 // Rotate object into position.
  20.                 transform.Rotate(objAngleX, objAngleY, objAngleZ);
  21.         }
  22.        
  23.         // Update is called once per frame.
  24.         void Update () {
  25.                
  26.                 transform.position = new Vector3(target.position.x, objPosY, target.position.z - objPosZ);
  27.         }
  28. }
« Last Edit: July 07, 2013, 06:05:38 PM by sloopernine »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: check if object is mine
« Reply #1 on: July 07, 2013, 07:11:25 PM »
target.GetComponent<TNObject>().isMine