コード例 #1
0
        public virtual void ApplyForce(Force force, IPhysicsEntity actor = null)
        {
            if (dynamicOnForce)
            {
                Rig.isKinematic = false;
                timeToSleep     = TimeToSleep;
                Rig.AddForce(force);
            }

            if (returnForce)
            {
                if (actor != null)
                {
                    actor.ApplyForce(-force * returnForceMultiplier);
                }
            }
        }
コード例 #2
0
 public static void ApplyForceFrom(this IPhysicsEntity physicsEntity, Transform to,
                                   Transform from, float power, ForceMode mode = ForceMode.VelocityChange)
 {
     physicsEntity.ApplyForce(
         new Force((to.position - from.position).normalized * power, mode));
 }