Git Product home page Git Product logo

incomplete-runningman's Introduction

RunningMan

Its not open source now..

incomplete-runningman's People

Contributors

jjhesk avatar

Watchers

 avatar

incomplete-runningman's Issues

attach with slider readings

public Slider speedControlSlider;
    public controlNormal shipcontrolengine;
    // Use this for initialization
    void Start ()
    {
        if (speedControlSlider != null) {
            speedControlSlider.onValueChanged.AddListener (onSpeedChange);
        }
    }

    // Update is called once per frame
    void Update ()
    {

    }

    public void onSpeedChange (float val)
    {
        if (shipcontrolengine != null) {
            shipcontrolengine.setExternalSpeedCurrent (val / 100);
        }
    }

rezz on the sphere

using UnityEngine;
using System.Collections;

public class RezzerOnSphere : MonoBehaviour
{

    public float angleControl = 90F, minDistance, maxDistance;
    public int objectCountMin, objectCountMax;
    public GameObject fab;
    // Use this for initialization
    void Start ()
    {
        if (objectCountMin > objectCountMax) {
            Debug.LogError ("objectCountMin needs to be smaller than objectCountMax");
            return;
        }
        if (objectCountMax < 1) {
            Debug.LogError ("objectCountMax needs to be bigger than zero;");
            return;
        }
        for (int i = 0; i<50; i++) {
            // Vector3 V = GetPointOnUnitSphereCap (transform.rotation, angleControl);
            Vector3 V = GenerateRandomPos ();
            // Debug.DrawRay (transform.position, V, Color.red);
            if (fab != null) {
                Quaternion rot = Quaternion.Euler (getNormal (V)); 
                //* Vector3.up;

                GameObject openobject = Instantiate (fab, V, Quaternion.identity) as GameObject;
                //Quaternion currentRot = T.localRotation;
                openobject.transform.rotation = Quaternion.FromToRotation (-openobject.transform.up, getNormal (V)) * openobject.transform.rotation;
                //T.transform.rotation = Quaternion.Euler (getNormal (V)) * -T.transform.up;
                //Quaternion.LookRotation(Vector3.up * getNormal(V)
                //openobject.transform.LookAt (getNormal (V));
                openobject.transform.parent = GameObject.FindGameObjectWithTag ("Ground").transform;
                //T.transform.TransformPoint (Quaternion.Euler (getNormal (V)) * Vector3.up);
            }
        }
    }

    public Vector3 getNormal (Vector3 vpos)
    {
        Vector3 t = GetComponent<Transform> ().position - vpos;
        float distance = t.magnitude;
        return t / distance;
    }
    // Update is called once per frame
    void Update ()
    {



    }

    public Vector3 GenerateRandomPos ()
    {
        Vector3 newPos = Random.onUnitSphere * Random.Range (minDistance, maxDistance);
        // newPos.y = originalPos.y;
        return newPos;
    }

    public Vector3 GetPointOnUnitSphereCap (Quaternion targetDirection, float angle)
    {
        float angleInRad = Random.Range (0.0F, angle) * Mathf.Rad2Deg;
        Vector3 pointoncircle = (Random.insideUnitCircle.normalized) * Mathf.Sin (angleInRad);
        float distance = Mathf.Tan (angleInRad);
        Vector2 PointOnCircle = Random.insideUnitCircle;
        //Mathf.Cos(angleInRad)
        Vector3 V = new Vector3 (PointOnCircle.x, PointOnCircle.y, distance);
        return targetDirection * V;
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.