NewtonCreateBody new head?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtonCreateBody new head?

Postby PJani » Fri Feb 18, 2011 1:35 pm

Hy i am finally changed from newton 2.24 to newton 2.32, but when i compile i get NewtonCreateBody doesnt take 2 argumets... ok no problem the only thing i want to know is what exaclly is matrixPtr parameter i mean for what?
NewtonBody* NewtonCreateBody(const NewtonWorld* const newtonWorld, const NewtonCollision* const collisionPtr, const dFloat* const matrixPtr)
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: NewtonCreateBody new head?

Postby Julio Jerez » Fri Feb 18, 2011 1:43 pm

newton 3.00 the bradPhaser nee to know teh location of the body when it is added to the tree.
To make it 2.00 and 3.00 compatible I added the same interface to 2.00, that wa I can use teh same demo to test 3.00
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCreateBody new head?

Postby PJani » Fri Feb 18, 2011 4:20 pm

hmm do i need to pass exact position orientation matrix or i can put zero position and id orientation? Because ogrenewt then needs lots of changes!
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: NewtonCreateBody new head?

Postby Julio Jerez » Fri Feb 18, 2011 5:01 pm

yes you can pass an identity matrix, of course
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCreateBody new head?

Postby PJani » Sat Feb 19, 2011 9:16 am

i dont know why i get crash here(in older version crashin didnt happend!)
Code: Select all
void calculateInertialMatrix( Ogre::Vector3& inertia, Ogre::Vector3& offset ) const { NewtonConvexCollisionCalculateInertialMatrix( m_col, &inertia.x, &offset.x ); }


Code: Select all
   OgreNewt::World* world = pbmgr->getNewtonWorld();

    Ogre::SceneNode* osn = sg->getSceneNode();

    if(!pb_tmpl->isStaticCollison())
    {
        OgreNewt::CollisionPtr cmp = NULL;

      if(!pb_tmpl->getCustomCollison())
        {

            //build sub node collisions
            unsigned short child_c = osn->numChildren();
            if(child_c>1)
            {
                std::vector<OgreNewt::CollisionPtr> colarry;
                while(child_c)
                {
                    //Get SceneNode
                    Ogre::SceneNode* object = dynamic_cast<Ogre::SceneNode*>(osn->getChild(--child_c));
                    if(!object){ continue ; }

                    //Get entity
                    Ogre::Entity* ent = dynamic_cast<Ogre::Entity*>(object->getAttachedObject(0));
                    if(!ent){ continue; }

                    //update scale
                    Ogre::Vector3 gs = object->getScale();
                    object->setScale(osn->getScale());
            
                    OgreNewt::CollisionPtr col = new OgreNewt::CollisionPrimitives::ConvexHull(world, ent ,child_c, Ogre::Quaternion::IDENTITY, object->getPosition()*osn->getScale());

                    //reset scale
                    object->setScale(gs);

                    //add compound
                    colarry.push_back(col);
                }
                //If none of colisons added then dont even try to create collison
                if(!colarry.empty())
                {
                    //build compound collison...
                    cmp = new OgreNewt::CollisionPrimitives::CompoundCollision(world,colarry,0);

                    //Destroy collisons
                    while(!colarry.empty())
                    {
                        delete colarry.back();
                        colarry.pop_back();
                    }
                }
            }
            else if(child_c==1)//Buld convex hull body
            {
                Ogre::SceneNode* object = dynamic_cast<Ogre::SceneNode*>(osn->getChild(0));
                if(object)
                {
                   
                    //Get entity
                    Ogre::Entity* ent = dynamic_cast<Ogre::Entity*>(object->getAttachedObject(0));
                    if(ent)
                    {
                        //Get First entity

                        //Change scale...
                        Ogre::Vector3 gs = object->getScale();
                        object->setScale(osn->getScale());

                        cmp = new OgreNewt::CollisionPrimitives::ConvexHull
                                (world, ent, 0, Ogre::Quaternion::IDENTITY, object->getPosition()*osn->getScale());

                        object->setScale(gs);
                    }
                }
            }

            //Create null body collison
            if(!cmp)
            {
               cmp = new OgreNewt::CollisionPrimitives::Null(world);
            }

        }
        else
        {
         cmp = pb_tmpl->getCustomCollison();
        }

        Ogre::Vector3 inertia; Ogre::Vector3 offsetCOM;
        if(cmp)
        {

            //cast collison for inertia and center of mass calculation...
            OgreNewt::ConvexCollision cccol(*cmp);

            //calculate inertia and center of mass
            cccol.calculateInertialMatrix(inertia,offsetCOM); //here crash happends

            m_Volume = cccol.calculateVolume();

        }
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: NewtonCreateBody new head?

Postby Julio Jerez » Sat Feb 19, 2011 9:47 am

It should not, were does it crashes?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCreateBody new head?

Postby PJani » Sat Feb 19, 2011 9:57 am

When is NewtonConvexCollisionCalculateInertialMatrix( m_col, &inertia.x, &offset.x ); beeing called application crashes if i use debug build of newton i get exit code 0x3! This in newton 2.24 wasnt happening.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: NewtonCreateBody new head?

Postby Julio Jerez » Sat Feb 19, 2011 10:59 am

In the version of OgreNewt than I have, I just chnag eteh prlject file an dmade OgreNet to dependt of the Netwon Libraies
I linked then statically,
I also make BodyCreate to pass teh identity matrix.

I run the convejor belt demo and seem to run fine
I put a break point on NewtonConvexCollisionCalculateInertialMatrix and It des hit that line with crashing.

I get lot of problem each tiem I try to test OgreNewt, because it is always far behind, so the version I have is very all and I make changes,
so it is possible thet teh current version is diffent that the one I have.

are you doing this for yourself of for the everone?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCreateBody new head?

Postby PJani » Sat Feb 19, 2011 12:22 pm

I have lastest possible version(which is VERY old 9.9.2010!!!), i needed to make some changes to raycast callback and to Body constructor, the only file i didnt update is OgreNewt_BasicJoints.h, this one is actually mine version, because i added mine joints(Wheel, Wing, Thrust,...).

This one is for me.
I am thinking of making new wrapper for newton if you expose c++ interface!
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: NewtonCreateBody new head?

Postby PJani » Sat Feb 19, 2011 12:37 pm

I think i found why i get error there, i get error there because in ConvexHull constructor function NewtonCreateConvexHull returns null! Was any change made to NewtonCreateConvexHull!?
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: NewtonCreateBody new head?

Postby Julio Jerez » Sat Feb 19, 2011 12:56 pm

No there have not bieng any change in the convex Hull,
The convex Hull do returns NULL, is the poit cloud doe no form a convex Hull, for exampel if tehy all fall into a flat plane, of a line
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCreateBody new head?

Postby PJani » Sat Feb 19, 2011 1:16 pm

Julio Jerez wrote:No there have no biend any change in the convex Hull,
The convex Hull do returns NULL, is the poit cloud doe no form a convex Hull, for exampel if tehy all fall into a flat plane, of a line


Actualy the entity i am trying to load is VERY large "desk" 600mx600 and 5m in height. Which would normaly load.

This is cloud the cloud.
Code: Select all
Vector3(-295.275, 0, 295.275)
Vector3(-295.275, 0, -295.275)
Vector3(295.275, 0, -295.275)
Vector3(295.275, 0, -295.275)
Vector3(295.275, 0, 295.275)
Vector3(-295.275, 0, 295.275)
Vector3(-295.275, 0.5, 295.275)
Vector3(295.275, 0.5, 295.275)
Vector3(295.275, 0.5, -295.275)
Vector3(295.275, 0.5, -295.275)
Vector3(-295.275, 0.5, -295.275)
Vector3(-295.275, 0.5, 295.275)
Vector3(-295.275, 0, 295.275)
Vector3(295.275, 0, 295.275)
Vector3(295.275, 0.5, 295.275)
Vector3(295.275, 0.5, 295.275)
Vector3(-295.275, 0.5, 295.275)
Vector3(-295.275, 0, 295.275)
Vector3(295.275, 0, 295.275)
Vector3(295.275, 0, -295.275)
Vector3(295.275, 0.5, -295.275)
Vector3(295.275, 0.5, -295.275)
Vector3(295.275, 0.5, 295.275)
Vector3(295.275, 0, 295.275)
Vector3(295.275, 0, -295.275)
Vector3(-295.275, 0, -295.275)
Vector3(-295.275, 0.5, -295.275)
Vector3(-295.275, 0.5, -295.275)
Vector3(295.275, 0.5, -295.275)
Vector3(295.275, 0, -295.275)
Vector3(-295.275, 0, -295.275)
Vector3(-295.275, 0, 295.275)
Vector3(-295.275, 0.5, 295.275)
Vector3(-295.275, 0.5, 295.275)
Vector3(-295.275, 0.5, -295.275)
Vector3(-295.275, 0, -295.275)


Edit: i realy dont know why some of points are being doubled
Last edited by PJani on Sat Feb 19, 2011 1:40 pm, edited 1 time in total.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: NewtonCreateBody new head?

Postby PJani » Sat Feb 19, 2011 1:38 pm

i checked parameters

the matrix passed is Id
1000
0100
0010
0001
tolerance is 0.001
id is 0
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: NewtonCreateBody new head?

Postby Julio Jerez » Sat Feb 19, 2011 3:00 pm

I pasted in the frition demo and you are correct it return NULL
But the Mesh for a big Box, soemthong is wrong.
was it even working?
I am debuging it now.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCreateBody new head?

Postby PJani » Sat Feb 19, 2011 3:07 pm

Jep it was working, with no problems! The same entity i am using since newton 1.53!
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests