First line in Start() was correct in Javascript and from what I have seen it is here unless I have to declare into a variable first?
So I did declare into a null variable.
And the other public vars are set in the inspector. But this line should select the GameObject it is on.
I am still converting this from JS to C.
//using Ludiq;
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
//[IncludeInSettings(true)]
public class VROGOHalo : MonoBehaviour
{
//************************************************************************
// These items show up in the inspector
//************************************************************************
public Transform target = null;
public Camera PC = null;
public float distance = 10.0f;
public float xSpeed = 75.0f; //Pulsar rotation speed 250
public float ySpeed = 75.0f; //Pulsar rotation speed 120
//**********************************
//Mouse cursor window parameters
//**********************************
public float xMinLimit = -20f;
public float xMaxLimit = 80f;
public float yMinLimit = -20f;
public float yMaxLimit = 80f;
public float yWindow = 2f; // Mouse Window edges
public float xWindow = 2f; // Mouse Window edges
//**********************************
// These items are available only in code
//**********************************
static public float xrotation = 0.0f;
static public float yrotation = 0.0f;
static public float xread = 0.0f;
static public float yread = 0.0f;
static public float xhbase = 5f; // Mouse Window edges
static public float xlbase = 5f; // Mouse Window edges
static public float yhbase = 5f; // Mouse Window edges
static public float ylbase = 5f; // Mouse Window edges
static public float windowBoundary = 3; //window boundaries
static public float xhigh = windowBoundary;
static public float xlow = windowBoundary;
static public float yhigh = windowBoundary;
static public float ylow = windowBoundary;
static public float csx = 0.0f;
static public float csy = 0.0f;
static public float Pulsarx;
static public float Pulsary;
static public float Pulsarz;
//private float z = 0.0f; //mod
//@script AddComponentMenu("Camera-Control/Mouse halo")
[AddComponentMenu("Camera-Control/Mouse halo")]
//****************************************************************
//****** Routines start here *************************************
//****************************************************************
//****************************************************************
public void Start()
{
UnityEditor.Selection.activeGameObject = gameObject;
//Selection.activeGameObject = gameObject; //This selects the hierarchy object
Debug.Log("Made it to Start");
PC = GameObject.Find("").GetComponent<Camera>(); // The default is Camera
if (!PC) {
Debug.Log("Camera not found");
return;
}
PC.transform.parent = transform; //This puts the Camera as child with parent!!!
Shotaim_neuter(); //Initializes variable at this point
CuebStatic();
//z = angles.z; // mod
// Make the rigid body not change rotation
//if (rigidbody)
// rigidbody.freezeRotation = true;
}
Thank you in advance. Months, weeks and days spent on this… I keep dabbling in it trying to fix this with out asking for help. I want to learn this on my own, but this is a brick wall to me.