
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"

Moderators: Sascha Willems, walaber
I will try to get it complete with more features like Jumps and crouch this weekend.
white tiger wrote:4) a minor thing. please do not use rar. it's a proprietary file format. use 7-zip instead
white tiger wrote:EDIT: where is the documentation?
white tiger wrote:EDIT2: Where is the NewtonContact structure?
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.
Julio Jerez wrote:I just copy the files.
how to I change them?
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?
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);
}
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();
}
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.
#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);
}
123 456
martinsm wrote:But how to know subshape of compound collision has collision?
Julio Jerez wrote:you are on linux right?
Users browsing this forum: No registered users and 0 guests