纳金网

标题: Follow Mouse (Interactive Behavior) [打印本页]

作者: Asen    时间: 2011-10-21 08:15
标题: Follow Mouse (Interactive Behavior)






               Follow Mouse (Interactive Behavior)
              









           Summary
         

           Causes the object to follow the mouse around the screen.
         





               Category
              


              Latest Behaviors
            




               Author
              


              Gavin Kistner
            




               Difficulty
              


              (Reference)
            




               Time to Complete
              


              5 Minutes
            








           Downloads
         


            Click Here
           
           to download the associated files.
         


            (This document covers version 1.0.1 of the 'Follow Mouse' behavior, current as of 2005-Feb-11)
           

            Description
           


             The
            
              When to Follow
            
             property controls when the object follows the mouse. By default, the object always follows the mouse, but you can have it only occur when the mouse is down (much like the Draggable behavior), when a certain key is down, or a variety of other events. If you use the last option, “
            
              (Action Controlled)
            
             ”, the object will only start following the mouse when the Start Following action is invoked on this behavior.
            

             By default, the object reacts instantly to changes in the mouse position. The various Advanced Properties described below allow you to control how the object follows the mouse.
            

             The
            
              Follow Delay
            
             property specifies how many frames the object should wait before following the mouse. For example, a value of ‘10’ means that the object will try to move to where the mouse was 10 frames ago, while the default value of 0 causes it to always move to where the mouse is right now.
            

             The
            
              Screen Offset
            
             property specifies a fixed offset (in pixels) from the mouse position that the object should move towards. For example, a value of “50, -20, 0” will cause the object to move to a spot 50 pixels to the right and 20 pixels below where the cursor is. (The z value is always ignored.)
            

             The
            
              Spring Tension
            
             property controls how hard the object is pulled to the desired spot. A value of 100 causes it to instantly snap to the desired spot, while a value of 50 causes it to move 50% of the distance each frame. Lower values give the object a smoother reaction to changes in the mouse position.
            

             Finally, the
            
              Holdoff Distance
            
             is a fixed distance (in the object space) that the object should stay away from the mouse. This is similar to the
            
              Screen Offset
            
             , but
            

             a) it is specified in world units, not pixels, and
            

             b) it specifies only distance, not location.
            

             Think of
            
              Holdoff Distance
            
             as a rigid pole attached between the end position and the object, which can pivot on both ends. The object will chase the mouse but stop before catching it, and if the mouse moves toward the object, it will push off to ensure it stays away from the mouse.
            

             All properties can be used in any combination. (Although some combinations may produce ‘interesting’ effects.)
            


            Basic Properties
           



              When to Follow
            

              When is this behavior active?
            

              Trigger Key
            

              If 'When to Follow' is 'Key Down', the name of the key to watch for.
            

              Stop on Reverse?
            

              Stop following the mouse when the 'opposite' event occurs?
            



            Advanced Properties
           



              Follow Delay
            

              Number of frames behind the mouse to trail.
            

              Screen Offset
            

              Fixed X/Y offset from the mouse for the object move to.
            

              Spring Tension
            

              How strong is the 'spring' between the object and the mouse? (100 is a rigid attachment.)
            

              Holdoff Distance
            

              Distance away from the the mouse/offset to keep.
            



            Actions
           



              Start Following
            

              Start applying this behavior.
            

              Stop Following
            

              Stop applying this behavior.
            

              Toggle
            

              If the parent is following the mouse, stop it; otherwise, start it.
            



            Events
           



              Started
            

              Fires when the behavior is started.
            

              Stopped
            

              Fires when the behavior is stopped.
            



            Demonstration
           




              View Demonstration Project
            




              Download Project File
            




作者: 晃晃    时间: 2012-1-31 23:21
快意吟诗句, 乐在得团圆。

作者: 晃晃    时间: 2012-2-17 23:20
加精、加亮滴铁子,尤其要多丁页丁页

作者: 晃晃    时间: 2012-2-18 23:19
再次路过……

作者: 菜刀吻电线    时间: 2012-4-11 23:19
好,真棒!!

作者: tc    时间: 2012-4-24 23:31
我无语!

作者: tc    时间: 2012-5-16 23:23
精典,学习了!

作者: 奇    时间: 2012-5-16 23:25
再看一看,再顶楼主

作者: 奇    时间: 2012-6-14 23:21
很有心,部分已收录自用,谢谢

作者: tc    时间: 2012-6-21 23:26
顶!学习了!阅!

作者: 晃晃    时间: 2012-11-8 23:19
先顶上去,偶要高亮加精鸟!





欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5