当前位置: 首页>>代码示例>>C#>>正文


C# Rigidbody.WakeUp方法代码示例

本文整理汇总了C#中UnityEngine.Rigidbody.WakeUp方法的典型用法代码示例。如果您正苦于以下问题:C# Rigidbody.WakeUp方法的具体用法?C# Rigidbody.WakeUp怎么用?C# Rigidbody.WakeUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Rigidbody的用法示例。


在下文中一共展示了Rigidbody.WakeUp方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

 private void Start()
 {
     r = GetComponent<Rigidbody>();
     if (r)
     {
         r.WakeUp();
         r.useGravity = false;
         r.freezeRotation = true;
         r.isKinematic = false;
     }
 }
开发者ID:Unknown-Studios,项目名称:OnePathfinding,代码行数:11,代码来源:GridAlign.cs

示例2: enableRigidBody

 void enableRigidBody(Rigidbody p_rbody)
 {
     p_rbody.isKinematic = false;
     p_rbody.detectCollisions = true;
     p_rbody.WakeUp();
 }
开发者ID:jarllarsson,项目名称:jwl_ld27,代码行数:6,代码来源:TimeBasedDisabler.cs

示例3: OnEnable

    protected virtual void OnEnable()
    {
        _frame = Random.Range(0, Interval);
        _interval = Interval;

        Rigidbody = GetComponentInParent<Rigidbody>();
        Rigidbody.WakeUp();
    }
开发者ID:steve-salmond,项目名称:LD33,代码行数:8,代码来源:Attract.cs

示例4: ThrowOrStoreItem

    void ThrowOrStoreItem()
    {
        Vector3 resultingDirection = (item.transform.position - previousItemPosition);

        // To track if handmovement is quick enough that the player wants to throw
        float maxThrowForce = Mathf.Abs(Mathf.Max(resultingDirection.x, resultingDirection.y, resultingDirection.z)) * 10.0f;

        //Debug.Log(maxThrowForce);

        if(inventory.isItemTouchingInventory(item.gameObject) && maxThrowForce < 0.2f)
        {
            inventory.storeItem(item, itemIsUsable, itemParent);
        }
        else
        {
            //print ("ThrowItem() called!");
            itemRigid = item.GetComponent<Rigidbody>();
            itemRigid.isKinematic = false;
            if(itemRigid.IsSleeping())
            {
                itemRigid.WakeUp();
            }
            itemRigid.AddForce(resultingDirection * 1/Time.deltaTime * 1.4f,ForceMode.VelocityChange);
            /*
            if(maxThrowForce < .3f)
            {
                itemRigid.AddForce(resultingDirection * 1/Time.deltaTime,ForceMode.VelocityChange);
            }
            else
            {
                itemRigid.AddForce(resultingDirection * 1/Time.deltaTime * 2.0f,ForceMode.VelocityChange);
            }
            */
            //print ("Added Force!");

            Collider[] colliders = item.GetComponents<Collider>();
            for(int i=0; i<colliders.Length; i++)
            {
                colliders[i].isTrigger = false;
            }

            if(itemParent != null)
            {
                if(!itemParent.Equals(hand.transform) || !item.transform.parent.name.Contains("unterarm"))
                {
                    //print("Parent ist not hand");
                    item.transform.parent = itemParent;
                }
            }
            else
            {
                item.transform.parent =  null;
            }

            if (itemIsUsable)
            {
                item.layer = 14;
            }
            else
            {
                item.layer = 9;
            }
            CheckItemUnderWorld();
        }

        if(itemIsUsable)
        {
            itemClass.OnDeequip();
            itemClass = null;
        }

        item = null;
        itemIsInHand = false;
        itemIsUsable = false;
    }
开发者ID:NoDruid,项目名称:Zerblobbung,代码行数:75,代码来源:Controls.cs


注:本文中的UnityEngine.Rigidbody.WakeUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。