[Papervision3D] Bug in cameras.

Tim Knip tim.knip at gmail.com
Sat Nov 24 12:13:47 PST 2007


Hi neolf,

The camera's default position = [0, 0, -1000]

Reason you can see 'B' is probably because of the perspective (i think).

Tim

2007/11/24, neolf(liufeng) <neolf.box at gmail.com>:
> Sorry  for my english,It's so poor.
> ^_^
> I do some job in Pv3D and I found some bug.
> I  put two  plane in the  scenes.
> cameras   (x,y,z)=(0,0,0) and lookat  Z axis.
> A is 300×400   (x,y,z)=(0,0,600)
>  B is 600×800   (x,y,z)=(0,0,1200)
>
> I think  the A will caver up  the B ,but I can see B's  border.
> the reason is the  cameras is not in the  (0,0,0),it's  in the (0,0,
> cameras.fouse)
>
> and then I write  this class to fix this bug.
>
> if you want change cameras's  rotation use :
>             camera.tilt(-m_x);
>             camera.pan(-m_y);
>
>
> -------------------------------code----------------------------------
>
> file:  NeoCamera3D.as
>
> package org.neolf.cameras
> {
> import org.papervision3d.core.Matrix3D;
> import org.papervision3d.core.proto.CameraObject3D;
> import org.papervision3d.objects.DisplayObject3D;
>
> public class NeoCamera3D extends CameraObject3D
> {
>
>     public function NeoCamera3D( zoom:Number=2, focus:Number=100,
> initObject:Object=null )
>     {
>         super( zoom, focus, null);
>         this.z=focus ;
>         trace(this.z+"|"+focus)
>     }
>
>     /**
>     * [internal-use] Transforms world coordinates into camera space.
>     */
>     // TODO OPTIMIZE (LOW)
>     public override function transformView( transform:Matrix3D=null ):void
>     {
>         if( this._transformDirty ) updateTransform();
>
>         // Rotate Z
>         super.transformView();
>     }
>
>
>     /**
>     * Rotate the camera in its vertical plane.
>     * <p/>
>     * Tilting the camera results in a motion similar to someone nodding
> their head "yes".
>     *
>     * @param    angle    Angle to tilt the camera.
>     */
>     public override function tilt( angle:Number ):void
>     {
>         super.rotationY = -angle;
>         updatePosition();
>     }
>
>     /**
>     * Rotate the camera in its horizontal plane.
>     * <p/>
>     * Panning the camera results in a motion similar to someone shaking
> their head "no".
>     *
>     * @param    angle    Angle to pan the camera.
>     */
>     public override function pan( angle:Number ):void
>     {
>         super.rotationX = angle;
>         updatePosition();
>     }
>
>          /**
>     * Rotate the camera in its horizontal plane.
>     * <p/>
>     * set camera -->0,0,0.
>     *
>     * @param    angle    Angle to pan the camera.
>     */
>     public function setZero():void
>     {
>         super.yaw(0);  super.pitch(0); super.roll(0);
>     }
>
>
>     //
> ___________________________________________________________________________________________________
>
>     /**
>     * update the Camera Position
>     *
>     * @return    void.
>     */
>     public function updatePosition(): void
>     {
>         var dp3d:DisplayObject3D=DisplayObject3D.ZERO;
>         dp3d.rotationY=this.rotationY ;
>         dp3d.rotationX=this.rotationX;
>         dp3d.moveForward(this.focus);
>         trace(dp3d.toString());
>         this.copyPosition(dp3d);
>     }
>
>
>
>     //
> ___________________________________________________________________________________________________
>
>     /**
>     * Returns a string value representing the three-dimensional position
> values of the display object instance.
>     *
>     * @return    A string.
>     */
>     public override function toString(): String
>     {
>         return this.name + ': x:' + Math.round(this.x) + ' y:' +
> Math.round(this.y) + ' z:' + Math.round(this.z);
>     }
>
>
> }
> }
> ------------------------------code
> end-----------------------------
>
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>


More information about the Papervision3D mailing list