20132177 / papervision3d

Automatically exported from code.google.com/p/papervision3d
0 stars 0 forks source link

Using a scaled DisplayObject3D in combination with do3d.localRotation* results in incorrect rotation of the object #186

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a big plane
2. set plane.scale to 0.1
3. increase plane.localRotationY by one on enter frame

What is the expected output? What do you see instead?
Rotating plane at normal speed. It results in a plane that is rotation very
slowly.

What version of the product are you using? On what operating system?
latest trunk

Please provide any additional information below.
1. Is pretty annoying in combination with loading external models. These
need to be resized very often.
2. plane.rotationY++ works as expected
3. Setting plane.scale to a value greater than 1 results in a faster
rotating plane.

Original issue reported on code.google.com by p...@paultondeur.nl on 14 Apr 2009 at 9:19

GoogleCodeExporter commented 8 years ago
Same happens with a scaled do3d and pitch/yaw/roll

Original comment by p...@paultondeur.nl on 14 Apr 2009 at 9:23

GoogleCodeExporter commented 8 years ago
Seems to happen when Quaternion.setFromAxisAngle is fed an axis which isn't
normalized. This patch seems to work:

public function setFromAxisAngle( x:Number, y:Number, z:Number, angle:Number 
):void
{
    // axis normalization
    var n:Number = Math.sqrt(x*x+y*y+z*z);
    x /= n;
    y /= n;
    z /= n;

    // original code
    var sin:Number = Math.sin( angle / 2 );
    var cos:Number = Math.cos( angle / 2 );
    this.x = x * sin;
    this.y = y * sin;
    this.z = z * sin;
    this.w = cos;
    this.normalize();
}

BUT - I have no idea if this mathematically correct, if it breaks any other 
parts of
Papervision and whether the this.normalize() call at the end is still 
necessary. Use
at your own risk.

Original comment by Yonatan....@gmail.com on 16 Apr 2009 at 1:02

GoogleCodeExporter commented 8 years ago
btw, i'm pretty sure this is a duplicate of issue 115.

Original comment by Yonatan....@gmail.com on 16 Apr 2009 at 1:13

GoogleCodeExporter commented 8 years ago
You're right, this is a duplication issue 115. Excuses for this duplicated bug 
report.

Original comment by p...@paultondeur.nl on 18 Apr 2009 at 3:16

GoogleCodeExporter commented 8 years ago
I tried the patch Yonatan offered (Thank you!), and while it is close, I find 
that
error accumulates as scale is changed and localRotations occur.  Eventually it 
gets
to the point where the error is visually noticeable.  Has anyone found a working
modificiation?

Original comment by mgre...@gmail.com on 5 Feb 2010 at 7:51

GoogleCodeExporter commented 8 years ago
Maybe related: I'd scaled an imported collada file down to 1% of its original 
size
and was rotating it forwards on the x axis using localRotationX, yet it was 
turning
backwards very slowly when viewed from a seperate vantage point (Another 
client, this
is a multiplayer project). I replaced it with a Max3DS model which I don't need 
to
scale (due to the size import difference) and the rotation is correct.

Original comment by garypa...@gmail.com on 28 Apr 2010 at 9:44