Code ( I can't understand) :

===============================================
===============================================
private function orbitAroundSphere(event:Event) : void
        {
            var _loc_2:* = Environment.getInstance().dMouseX;
            var _loc_3:* = Environment.getInstance().dMouseY;
            if (_loc_2 < -0.5)
            {
                _loc_2 = 0;
            }
            if (_loc_3 < -0.5)
            {
                _loc_3 = 0;
            }
            if (_loc_2 > 0.5)
            {
                _loc_2 = 0.5;
            }
            if (_loc_3 > 0.5)
            {
                _loc_3 = 0.5;
            }
            var _loc_4:* = (-_loc_2 / speed) * piRad;
            var _loc_5:* = (-_loc_3 / speed) * piRad;
            var _loc_6:* = Math.sin(_loc_4);
            var _loc_7:* = Math.sin(_loc_5);
            var _loc_8:* = Math.cos(_loc_4);
            var _loc_9:* = Math.cos(_loc_5);
            var _loc_10:* = this.zPos * _loc_9 - this.xPos * _loc_7;
            this.xPos = this.zPos * _loc_7 + this.xPos * _loc_9;
            this.zPos = this.yPos * _loc_6 + _loc_10 * _loc_8;
            this.yPos = this.yPos * _loc_8 - _loc_10 * _loc_6;
            var _loc_11:* = Math.sqrt(this.xPos * this.xPos +
this.yPos * this.yPos + this.zPos * this.zPos);
            var _loc_12:* = Environment.getInstance().radius;
            if (fRad < _loc_12)
            {
                fRad = fRad + (counter * (fRad / _loc_12 / _loc_12) +
8);
                var _loc_15:* = counter + 1;
                counter = _loc_15;
            }
            else
            {
                fRad = _loc_12;
            }
            this.xPos = this.xPos / _loc_11 * fRad;
            this.yPos = this.yPos / _loc_11 * fRad;
            this.zPos = this.zPos / _loc_11 * fRad;
            var _loc_13:* = Environment.getInstance().fl / (this.zPos
+ Environment.getInstance().fl);
            var _loc_14:* = _loc_13;
            this.scaleY = _loc_13;
            this.scaleX = _loc_14;
            this.x = this.xPos * _loc_13;
            this.y = this.yPos * _loc_13;
            if (this.zPos > -110)
            {
                this.alpha = 0.65;
            }
            else
            {
                this.alpha = 1;
            }
            return;
        }// end function
===============================================
===============================================
On 11月15日, 下午11时44分, mogg <[email protected]> wrote:
> One of the simplest ways is to use an  "ObjectContainer3D" and place
> your visiable object inside this object container.
>
> Steps:
> 1) Add an empty "ObjectContainer3D" to the scene
> 2) Then add your other object (sphere) inside this
> "ObjectContainer3D".
> 3) To do "free rotation" only rotate one axis of each of these two
> object.
> 4) Rotate the X axis of your inner object (sphere) and then rotate the
> Y axis of the outer object "ObjectContainer3D".
>
> Play around with the results. Try swapping which axis you rotate on
> each object.
>
> This should give you the free rotation you are looking for.
>
> On Nov 15, 3:37 am, "[email protected]" <[email protected]> wrote:
>
> > I want to do some interest thing. So I created a sphere, and rotate it
> > by change mouse position. And if I turn the yAxis to another side ,
> > the sphere will not rotate will mouse will.
>
> > So if you cant understand, then see the website. It can free rotation
> > it easyly.
>
> > exp:http://www.speakinthumbs.com/

Reply via email to