Newton 2.0x Archemedia Open Beta

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Newton 2.0x Archemedia Open Beta

Postby VeT » Thu Jul 30, 2009 6:55 pm

Very-very large "thank you" for your work :)

I'll check tutors now

I will try to get it complete with more features like Jumps and crouch this weekend.

And dont forget about "dribbling on the stairs" ;)
1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy
LiteC+Newton2 download: http://hosted.filefront.com/NeArGa
LiteC+Newton2 discussion: http://tinyurl.com/6l7y9v
VeT
 
Posts: 84
Joined: Thu Jul 31, 2008 11:31 am

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Thu Jul 30, 2009 11:57 pm

The first of the wiki tutorials for are on the wiki, including fully working Iphone/Ipot touch
http://newtondynamics.com/wiki/index.php5?title=Tutorials
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Mon Aug 03, 2009 11:34 am

I added Beta 2.05
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0 Archemedia Open Beta

Postby JernejL » Mon Aug 03, 2009 12:57 pm

white tiger wrote:4) a minor thing. please do not use rar. it's a proprietary file format. use 7-zip instead


Rar is a rather nice format, while it's proprietary it is high popular and compresses very well.

white tiger wrote:EDIT: where is the documentation?


Check our wiki

white tiger wrote:EDIT2: Where is the NewtonContact structure?


It's not a "structure", it's a joint / pointer to a "contact joint".
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Newton 2.0x Archemedia Open Beta

Postby Svenstaro » Tue Aug 04, 2009 11:16 pm

I'd like to point out a few things in order to raise the quality of the packages. I'm using 2.04 Linux32/Linux64 for a reference:
  • The included license says it's for 1.53 and since we are now up to Newton 2 it should probably say so.
  • (Almost ?) all included binary/text/source/help files are executable (755). They should be 644, including *.a, *.h and *.cpp. *.so needs to be 755 because it is meant to be executable.
  • There are a couple of save files and swap files that shouldn't be included. For example: 'newtonSDK/samples/makefile~', 'newtonSDK/samples/*.kdbgrc.NewtonDemos.elf' (only x86_64), 'newtonSDK/samples/sdkDemos/OGLMesh.h~' (only x86_64), 'newtonSDK/samples/sdkDemos/toolBox/toolbox_stdafx.h~' and probably a few more that I didn't catch.
I'm not saying this to be annoying or to be picky.
Svenstaro
 
Posts: 16
Joined: Mon Aug 04, 2008 1:38 pm

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Wed Aug 05, 2009 9:10 am

Svenstaro wrote:(Almost ?) all included binary/text/source/help files are executable (755). They should be 644, including *.a, *.h and *.cpp. *.so needs to be 755 because it is meant to be executable.

I will fix the lincence, thanks

what does 755 and 644 means?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby martinsm » Wed Aug 05, 2009 10:22 am

Those are file permissions in octal notation (4 = read, 2 = write, 1 = execute): http://en.wikipedia.org/wiki/File_permi ... l_notation
So 7 means rwx - text and source files should not be executable, but only rw (4+2=6).
martinsm
 
Posts: 86
Joined: Mon Dec 19, 2005 3:15 pm
Location: Latvia

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Wed Aug 05, 2009 10:29 am

I just copy the files.
how to I change them?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby martinsm » Wed Aug 05, 2009 10:34 am

I have question about shapeID in collision creation functions. Why NewtonCreateConvexHullModifier and NewtonCreateCompoundCollision functions doesn't have them? What does NewtonCollisionGetUserID function returns for these collisions? Previously it was possible to call SetUserID function for Compound and HullModifier collisions. What to do now?
martinsm
 
Posts: 86
Joined: Mon Dec 19, 2005 3:15 pm
Location: Latvia

Re: Newton 2.0x Archemedia Open Beta

Postby martinsm » Wed Aug 05, 2009 10:46 am

Julio Jerez wrote:I just copy the files.
how to I change them?

That means they has incorrect permission masks on files from where are you copying them. Permission masks can be changed with chmod command on command line (or with any file manager GUI).
martinsm
 
Posts: 86
Joined: Mon Dec 19, 2005 3:15 pm
Location: Latvia

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Wed Aug 05, 2009 11:08 am

martinsm wrote:Why NewtonCreateConvexHullModifier and NewtonCreateCompoundCollision functions doesn't have them? What does NewtonCollisionGetUserID function returns for these collisions? Previously it was possible to call SetUserID function for Compound and HullModifier collisions. What to do now?

when you get a callback the ID is set to the shape the generate the collision.
therefore the shapeID of the parent shape is not need it in a call back,
If you read the ID using teh funtion NewtonCollisionGetID it will return zero.

NewtonCreateConvexHullModifier inherits the ID from the child shape
NewtonCreateCompoundCollision will return zero, if you need to get the ID of the subchapes then you need to use GetInfo and read the ID from the child shapes array.

there is an exeption, for polygonal mesh, like collision trees,
since they can have tousands of faces they can not be saved a array of shapes, instead they are stored in more optimized format.
and then ther is a funtion to read the ID from the colliding face.

if you check the Advance Material tutorial you will see how it is used. here is the code snipe
Code: Select all
   void ContactProcess (const NewtonJoint* contactJoint, dFloat timestep, int threadIndex)
   {
      dFloat contactBestSpeed;
      dVector contactPosit;
      void* bestSound;
      NewtonBody* body0;
      NewtonBody* body1;

      bestSound = NULL;
      contactBestSpeed = 0.5f;
      body0 = NewtonJointGetBody0(contactJoint);
      body1 = NewtonJointGetBody1(contactJoint);
      for (void* contact = NewtonContactJointGetFirstContact (contactJoint); contact; contact = NewtonContactJointGetNextContact (contactJoint, contact)) {
         int id0;
         int id1;
         dFloat contactNormalSpeed;
         NewtonMaterial* material;
         const PhysicsMaterialInteration* appMaterial;

         // get the material for this contact;
         material = NewtonContactGetMaterial (contact);

         id0 = NewtonMaterialGetBodyCollisionID (material, body0);
         if (id0 == 0) {
            id0   = NewtonMaterialGetContactFaceAttribute (material);
         }
         id1 = NewtonMaterialGetBodyCollisionID (material, body1);
         if (id1 == 0) {
            id1   = NewtonMaterialGetContactFaceAttribute (material);
         }




When you ge the collision call back the collision generating the contact is placed into teh Material
There are two shaped there one for body0 and oen for body1

Thsi funtion
id0 = NewtonMaterialGetBodyCollisionID (material, body0);

coudl be the same as
NewtonCollisionGetID (NewtonBodyGetCollision(body0))

only wh neth shape is a sibgle shape, when teh shape is a compound shape then teh will returne difrenect values.
NewtonCollisionGetID (NewtonBodyGetCollision(body0))
will return the parent shape id, and id0 = NewtonMaterialGetBodyCollisionID (material, body0) will return the child shape generation teh collisions


what Id do is that I use 0 for as and identifies that shape is a poligonal shape an dteh ID of the face must be read form the face ID .

if (id0 == 0) {
id0 = NewtonMaterialGetContactFaceAttribute (material);
}

I tried a lot to removed that small inconsitency, but the only solution fo that is to convere teh face that particimate in a collision into collision shapes, but that requres a significan overhead.
here is the function that gets the collision ID from a material
Code: Select all
unsigned NewtonMaterialGetBodyCollisionID(const NewtonMaterial* material, const NewtonBody* body)
{
//   dgUnsigned64 val;
   dgBody *bodyPtr;
   dgCollision* collision;
   dgContactMaterial* materialPtr;

   TRACE_FUNTION(__FUNCTION__);
   bodyPtr = (dgBody*) body;
   materialPtr = (dgContactMaterial*) material;

   collision = materialPtr->m_collision0;
   if (bodyPtr == materialPtr->m_body1) {
      collision = materialPtr->m_collision1;
   }

   return collision->GetUserDataID();
}


as you can see the ID is collected from the collision tha is saved into the Material, therefore the only way to unify the shape and teh faces is if the faces where also collision shapes, but they are not, they are in a flat array of indice and vertices.



martinsm wrote:Previously it was possible to call SetUserID function for Compound and HullModifier collisions. What to do now?

Are you using that funtionality for compound shapes and modifies?
do you need it.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby martinsm » Wed Aug 05, 2009 11:25 am

Are you using that funtionality for compound shapes and modifies?
do you need it.

Yes, I was using it. Now I was updating old game project to use Newton 2.x version and it was working incorrectly, because collisions between objects were not reported properly.

Now I will update code to what you told - for hull modifier it will change nothing, and for compound collisions I will try getting real collision with GetInfo method. But how to know subshape of compound collision has collision?

I'm using user ID's for collisions as material indications. For example, compound collision for tree can consist from two simple collisions - cone for leaves and branches, and cylinder for trunk. And each collision has different material id (wood, and leaves). When collision occurs with it and some other object, then I look up appropriate sound to play for specific material (wood, leaves). So I want to know child collision user ID for compound collision that is reported in ContactProcess callback.

Edit: I tried with ConvexHullModifier collision. Unfortunately it always returns 0 for user id. It does not inherit user id from child collision.
Here is test case:
Code: Select all
#include <Newton.h>
#include <stdio.h>

struct temp
{
    const NewtonBody* body0;
    const NewtonBody* body1;
};

int aabb(const NewtonMaterial* material, const NewtonBody* body0, const NewtonBody* body1, int threadIndex)
{
    temp* t = (temp*)NewtonMaterialGetMaterialPairUserData(material);
    t->body0 = body0;
    t->body1 = body1;
    return 1;
}

void process(const NewtonJoint* joint, dFloat timestep, int threadIndex)
{
    for (void* contact = NewtonContactJointGetFirstContact(joint); contact != NULL; contact = NewtonContactJointGetNextContact(joint, contact))
    {
        NewtonMaterial* material = NewtonContactGetMaterial(contact);
        temp* t = (temp*)NewtonMaterialGetMaterialPairUserData(material);

        int id0 = NewtonMaterialGetBodyCollisionID(material, t->body0);
        int id1 = NewtonMaterialGetBodyCollisionID(material, t->body1);

        printf("%i %i\n", id0, id1);
    }
}

int main()
{
    NewtonWorld* w = NewtonCreate(NULL, NULL);
   
    int id = NewtonMaterialGetDefaultGroupID(w);
   
    {
        NewtonCollision* c = NewtonCreateBox(w, 1, 1, 1, 123, NULL);
        NewtonBody* b = NewtonCreateBody(w, c);
        NewtonBodySetMassMatrix(b, 1, 1, 1, 1);
        NewtonBodySetAutoSleep(b, 0);
        NewtonReleaseCollision(w, c);
    }

    {
        NewtonCollision* c = NewtonCreateSphere(w, 1, 1, 1, 456, NULL);

        c = NewtonCreateConvexHullModifier(w, c); // ***

        NewtonBody* b = NewtonCreateBody(w, c);
        NewtonBodySetMassMatrix(b, 1, 1, 1, 1);
        NewtonBodySetAutoSleep(b, 0);
       
        float m[16] = { 0 };
        m[0] = m[5] = m[10] = m[15] = 1.0f;
        m[13] = 5.0f;
        NewtonBodySetMatrix(b, m);
       
        float v[3] = { 0 };
        v[1] = -1.0f;
        NewtonBodySetVelocity(b, v);

        NewtonReleaseCollision(w, c);
    }

    temp t;
    {
        NewtonMaterialSetCollisionCallback(w, id, id, &t, aabb, process);
        NewtonMaterialSetDefaultCollidable(w, id, id, 1);
    }

    for (;;)
    {
        NewtonUpdate(w, 0.016f);
    }

    NewtonDestroy(w);
}


It should print
Code: Select all
123 456

but instead prints "123 0".

If you comment out (or delete) line marked with *** then it prints out correctly "123 456".
martinsm
 
Posts: 86
Joined: Mon Dec 19, 2005 3:15 pm
Location: Latvia

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Wed Aug 05, 2009 11:44 am

I will put SetCollisonID back tonight.
that should solve it for you.

you are on linux right?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby JernejL » Wed Aug 05, 2009 12:49 pm

martinsm wrote:But how to know subshape of compound collision has collision?


easy, compounds are only made of other collision parts, you can call getinfo recursively to see the whole structure ofcompounds.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Newton 2.0x Archemedia Open Beta

Postby martinsm » Wed Aug 05, 2009 2:33 pm

Julio Jerez wrote:you are on linux right?


No, I am mainly on Windows. But I develop also under Linux and MacOSX :)
Julio, you could add "int shapeID" argument also for HullModifier and CompoundCollision Create functions. Then there will be no need for SetUserID function.

Delfi: What I was asking - how to know which child collision of compound collision are actually in contact with some other collision. In CollisionProcess callback I can get body which are in collision. From it I can get its compound collision. And from it I can get child collisions. But which of child collisions are actually in contact with collision from other body?
martinsm
 
Posts: 86
Joined: Mon Dec 19, 2005 3:15 pm
Location: Latvia

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron