Git Product home page Git Product logo

unitychan-crs's People

Contributors

i-saint avatar keijiro avatar nobuyuki-kobayashi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unitychan-crs's Issues

SpringBone has bugs if fps is too high ,springBone will faster, otherwise slower.

//
//SpringBone.cs for unity-chan!
//
//Original Script is here:
//ricopin / SpringBone.cs
//Rocket Jump : http://rocketjump.skr.jp/unity3d/109/
//https://twitter.com/ricopin416
//
//Revised by N.Kobayashi 2014/06/20
// Revised by ken, 2019/9/19, fixed fps related issue.
//
using UnityEngine;
using System.Collections;

namespace UnityChan
{
public class SpringBone : MonoBehaviour
{
//次のボーン
public Transform child;

    //ボーンの向き
    public Vector3 boneAxis = new Vector3(-1.0f, 0.0f, 0.0f);
    public float radius = 0.05f;

    //各SpringBoneに設定されているstiffnessForceとdragForceを使用するか?
    public bool isUseEachBoneForceSettings = true;

    //バネが戻る力
    public float stiffnessForce = 0.01f;

    //力の減衰力
    public float dragForce = 0.4f;
    public Vector3 springForce = new Vector3(0.0f, -0.0001f, 0.0f);
    public SpringCollider[] colliders;
    public bool debug = true;
    //Kobayashi:Thredshold Starting to activate activeRatio
    public float threshold = 0.01f;
    private float springLength;
    private Quaternion localRotation;
    private Transform trs;
    private Vector3 currTipPos;
    private Vector3 prevTipPos;
    //Kobayashi
    private Transform org;
    //Kobayashi:Reference for "SpringManager" component with unitychan 
    private SpringManager managerRef;

	public void Awake()
	{
		trs = transform;
		localRotation = transform.localRotation;
		managerRef = GetComponentInParent<SpringManager>();

        
    }
    public void OnEnable()
    {
		//Kobayashi:Reference for "SpringManager" component with unitychan
		// GameObject.Find("unitychan_dynamic").GetComponent<SpringManager>();
	    

		springLength = Vector3.Distance (trs.position, child.position);
		currTipPos = child.position;
		prevTipPos = child.position;
    }

    /// <summary>
    /// Update by ken.
    /// alteration fps related to time related.
    /// </summary>
    public void UpdateSpring()
    {
        const float FORCE_SCALE = 1000f;
        const float SPEED_SCALE = 10;


        var toPrev = currTipPos - prevTipPos;
        var dt = Time.deltaTime;

        var force = trs.rotation * (boneAxis * stiffnessForce) * FORCE_SCALE;
        force += -toPrev * dragForce * FORCE_SCALE * dt;
        force += springForce * FORCE_SCALE * dt;

        prevTipPos = currTipPos;
        currTipPos += (toPrev + force *0.1f)* SPEED_SCALE * dt;


        currTipPos = trs.position + (currTipPos - trs.position).normalized * springLength;

        currTipPos = CheckColliders(currTipPos);

        var aimDir = trs.TransformDirection(boneAxis);
        var aimRot = Quaternion.FromToRotation(aimDir, currTipPos - trs.position);
        //trs.rotation = aimRot * trs.rotation;
        trs.rotation = Quaternion.Lerp(trs.rotation, aimRot * trs.rotation,managerRef.dynamicRatio);
    }

    Vector3 CheckColliders(Vector3 currTipPos)
    {
        for (int i = 0; i < colliders.Length; i++)
        {
            if (Vector3.Distance(currTipPos, colliders[i].transform.position) <= (radius + colliders[i].radius))
            {
                Vector3 normal = (currTipPos - colliders[i].transform.position).normalized;
                currTipPos = colliders[i].transform.position + (normal * (radius + colliders[i].radius));
                currTipPos = ((currTipPos - trs.position).normalized * springLength) + trs.position;
            }
        }
        return currTipPos;
    }

    private void OnDrawGizmos()
    {
        if (debug)
        {
            Gizmos.color = Color.yellow;
            Gizmos.DrawWireSphere(currTipPos, radius);
        }
    }
}

}

README.MD / Repo URL is not valid

#7 こちらのPRにもある通り、概要欄とREADME.MD 上のリンクに誤りがあるかと思います。

現在のリンク : http://unity-chan.com/events/c86/WebPlayer/
正しいリンク : http://unity-chan.com/event/c86/WebPlayer/

また、README.MD のスクリーンショットも同様にNot Foundが発生しています。
https://camo.githubusercontent.com/07f919b41cb03380f736646d3524166400d24d9c/687474703a2f2f756e6974792d6368616e2e636f6d2f626c6f672f77702d636f6e74656e742f75706c6f6164732f323031342f30382f756e697465696e746865736b795f73732e6a7067

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.