NaN in initial transform callbacks

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

NaN in initial transform callbacks

Postby lost_jedi » Mon Feb 07, 2011 5:41 pm

Hey,

I am encountering what seems to be a rather strange behaviour with the values returned on a NewtonBodySetTransformCallback and the VSHOST debugger.

I am working in C# using VS2010 with Newton version 2.30 x32. The C# wrapper is P/Invoke based. When executing with the VSHOST process attached it all works fine. I get a single transform callback which contains the expected data ... see below ...

Code: Select all
NewtonRigidBody.callback_NewtonTransform ndg->engine
[
[M11:1 M12:0 M13:0 M14:0]
[M21:0 M22:1 M23:0 M24:0]
[M31:0 M32:0 M33:1 M34:0]
[M41:0 M42:0 M43:0 M44:1]
]


However, when the process is detached (i.e. it is run as a normal exe) I get 3 callbacks, each with the position filled out as NaN.

Code: Select all
NewtonRigidBody.callback_NewtonTransform ndg->engine
[
[M11:1 M12:0 M13:0 M14:0]
[M21:0 M22:1 M23:0 M24:0]
[M31:0 M32:0 M33:1 M34:0]
[M41:NaN M42:NaN M43:NaN M44:1]
]

NewtonRigidBody.callback_NewtonTransform ndg->engine
[
[M11:1 M12:0 M13:0 M14:0]
[M21:0 M22:1 M23:0 M24:0]
[M31:0 M32:0 M33:1 M34:0]
[M41:NaN M42:NaN M43:NaN M44:1]
]


NewtonRigidBody.callback_NewtonTransform ndg->engine
[
[M11:1 M12:0 M13:0 M14:0]
[M21:0 M22:1 M23:0 M24:0]
[M31:0 M32:0 M33:1 M34:0]
[M41:NaN M42:NaN M43:NaN M44:1]
]


I am at a complete loss. I am able to set the value a few frames later with: NewtonBodySetMatrix

Any ideas? Thanks in advance!

John
lost_jedi
 
Posts: 12
Joined: Thu Aug 21, 2008 7:45 pm

Re: NaN in initial transform callbacks

Postby lost_jedi » Mon Feb 07, 2011 6:12 pm

I dropped back to the older library versions to see if it makes a difference - no such luck.

Under 2.29, when I use the debug binaries I get the following (in order)..

VSHOST attached:
Code: Select all
File: ..\..\..\sdk\physics\dgCollision.cpp
Line: 73
Expression: det > dgFloat32 (0.999f)
---------------------------
File: c:\newton_200\3dlib\sdk\corelib\dgVector.h
Line: 284
Expression: dgCheckVector ((*this))
---------------------------



Normal Execution:
Code: Select all
File: ..\..\..\sdk\physics\dgCollision.cpp
Line: 73
Expression: det > dgFloat32 (0.999f)
---------------------------
File: c:\newton_200\3dlib\sdk\corelib\dgVector.h
Line: 284
Expression: dgCheckVector ((*this))
---------------------------
File: c:\newton_200\3dlib\sdk\corelib\dgVector.h
Line: 284
Expression: dgCheckVector ((*this))
---------------------------
File: c:\newton_200\3dlib\sdk\corelib\dgVector.h
Line: 284
Expression: dgCheckVector ((*this))
---------------------------
File: ..\..\..\sdk\physics\dgConvexCollision.cpp
Line: 505
Expression: inertiaOut[0] > 0.0f
---------------------------
File: ..\..\..\sdk\physics\dgConvexCollision.cpp
Line: 506
Expression: inertiaOut[1] > 0.0f
---------------------------
File: ..\..\..\sdk\physics\dgConvexCollision.cpp
Line: 507
Expression: inertiaOut[3] > 0.0f
---------------------------
File: ..\..\..\sdk\physics\dgBody.cpp
Line: 73
Expression: Ix > dgFloat32 (0.0f)
---------------------------
File: ..\..\..\sdk\physics\dgBody.cpp
Line: 74
Expression: Iy > dgFloat32 (0.0f)
---------------------------
File: ..\..\..\sdk\physics\dgBody.cpp
Line: 75
Expression: Iz > dgFloat32 (0.0f)
---------------------------
File: c:\newton_200\3dlib\sdk\corelib\dgVector.h
Line: 305
Expression: dgCheckVector ((*this))
---------------------------
File: c:\newton_200\3dlib\sdk\corelib\dgVector.h
Line: 305
Expression: dgCheckVector ((*this))
---------------------------
File: c:\newton_200\3dlib\sdk\corelib\dgVector.h
Line: 305
Expression: dgCheckVector ((*this))
---------------------------

***

NOW IT GETS INTERESTING SINCE THIS IS WHERE THE BODY IS CREATED

***

---------------------------
File: ..\..\..\sdk\physics\dgBody.cpp
Line: 482
Expression: m_invWorldInertiaMatrix[0][3] == dgFloat32 (0.0f)
---------------------------
File: ..\..\..\sdk\physics\dgBody.cpp
Line: 483
Expression: m_invWorldInertiaMatrix[1][3] == dgFloat32 (0.0f)
---------------------------
File: ..\..\..\sdk\physics\dgBody.cpp
Line: 484
Expression: m_invWorldInertiaMatrix[2][3] == dgFloat32 (0.0f)
---------------------------
File: c:\newton_200\3dlib\sdk\corelib\dgVector.h
Line: 165
Expression: dgCheckVector ((*this))
---------------------------
File: c:\newton_200\3dlib\sdk\corelib\dgVector.h
Line: 305
Expression: dgCheckVector ((*this))
---------------------------
File: c:\newton_200\3dlib\sdk\corelib\dgVector.h
Line: 284
Expression: dgCheckVector ((*this))
---------------------------
File: ..\..\..\sdk\physics\dgBody.cpp
Line: 571
Expression: dgCheckFloat(m_matrix[i][j])
---------------------------
File: ..\..\..\sdk\physics\dgBody.cpp
Line: 571
Expression: dgCheckFloat(m_matrix[i][j])
---------------------------
File: ..\..\..\sdk\physics\dgBody.cpp
Line: 571
Expression: dgCheckFloat(m_matrix[i][j])
---------------------------
File: c:\newton_200\3dlib\sdk\corelib\dgVector.h
Line: 305
Expression: dgCheckVector ((*this))
---------------------------

... now I'm bored of typing since you get the idea :)

lost_jedi
 
Posts: 12
Joined: Thu Aug 21, 2008 7:45 pm

Re: NaN in initial transform callbacks

Postby Julio Jerez » Mon Feb 07, 2011 7:35 pm

I think you teh matrix you are passing is not a normalize transformation matrix.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NaN in initial transform callbacks

Postby lost_jedi » Mon Feb 07, 2011 8:37 pm

This is before I even give it a position, and even when I do, I only pass it an identity. Doesn't get much more normalised than that!
lost_jedi
 
Posts: 12
Joined: Thu Aug 21, 2008 7:45 pm


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 5 guests

cron