windrobin / papervision3d

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

Null property exception when Mouse3D.enabled set to true and PhongMaterial used on DAE object. #157

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create interactive viewport
2. Mouse3D.enable = true
3. replace material on DAE object with PhongMaterial
4. set all materials on DAE object to interactive = true

What is the expected output? What do you see instead?
No exception.

What version of the product are you using? On what operating system?
PV3D 2.0 Trunk - build 856

Please provide any additional information below.

Call Stack:-

Matrix3D::calculateMultiply() Line 214
Matrix3D::multiply() Line 248
Mouse3D::updatePosition() Line 73
InteractiveSceneManager::handleEnterFrame() Line 294

Actual cause of problem is in Mouse3D in the following code :-

var zAxis:Number3D = Number3D.sub(target, position);
zAxis.normalize();

if (zAxis.modulo > 0.1)
{
    var xAxis:Number3D = Number3D.cross(zAxis, UP);
    xAxis.normalize();

    var yAxis:Number3D = Number3D.cross(zAxis, xAxis);
    yAxis.normalize();

    var look:Matrix3D = this.transform;

    look.n11 = xAxis.x;
    look.n21 = xAxis.y;
    look.n31 = xAxis.z;

    look.n12 = -yAxis.x;
    look.n22 = -yAxis.y;
    look.n32 = -yAxis.z;

    look.n13 = zAxis.x;
    look.n23 = zAxis.y;
    look.n33 = zAxis.z;
}

var m:Matrix3D = Matrix3D.IDENTITY;

//
// This is the bug line
//
this.transform = Matrix3D.multiply(face3d.instance.world, look);

if zAxis.modulo is <= 0.1 then 'look' is never populated and is null.  
Then the 2nd parameter to multiply() and calculateMultiply is null and no 
check is performed and hence the exception in referencing a null property.

Original issue reported on code.google.com by andy.gri...@gmail.com on 31 Dec 2008 at 7:01

GoogleCodeExporter commented 9 years ago
assigning

Original comment by neori...@gmail.com on 13 Jan 2009 at 2:22

GoogleCodeExporter commented 9 years ago
Swapped it to use the identity matrix if behind.  there should be no nulls now 
(let
me know if that works!)

Original comment by azu...@gmail.com on 30 Mar 2009 at 1:53

GoogleCodeExporter commented 9 years ago
Tested - works fine. Many thanks.

Andy

Original comment by andy.gri...@gmail.com on 31 Mar 2009 at 4:41