Aldeminor wrote:Julio, can you post link on fullsize logo of Newton? We want to place it in the bootscreen of our project
- Click Here
Moderators: Sascha Willems, walaber
Aldeminor wrote:Julio, can you post link on fullsize logo of Newton? We want to place it in the bootscreen of our project
public static int AddBodyConvHull(int physic_World , TVMesh Mesh, double mass, double lin_damp, Vector3 ang_damp)
{
int count = Mesh.GetVertexCount();
double[] points = new double[count * 3];
int number;
for (number = 0; number < count; number++)
{
float X=0, Y=0, Z=0, temp=0;
int temp2 = 0;
Mesh.GetVertex(number, ref X, ref Y, ref Z, ref temp, ref temp, ref temp, ref temp, ref temp, ref temp, ref temp, ref temp2);
points[number * 3] = X;
points[number * 3 + 1] = Y;
points[number * 3 + 2] = Z;
}
Matrix mat = new Matrix();
mat = MatrixTV2Matrix(Mesh.GetMatrix());
Matrix mat2 = new Matrix();
mat2.M11 = 1;
mat2.M12 = 0;
mat2.M13 = 0;
mat2.M14 = 0;
mat2.M21 = 0;
mat2.M22 = 1;
mat2.M23 = 0;
mat2.M24 = 0;
mat2.M31 = 0;
mat2.M32 = 0;
mat2.M33 = 1;
mat2.M34 = 0;
mat2.M41 = 0;
mat2.M42 = 0;
mat2.M43 = 0;
mat2.M44 = 1;
int shapeID = 0;
int colis = NewtonWrapper.CreateConvexHull(physic_World, count, points, 24, 0.1f, shapeID, ref mat2);
int body = NewtonWrapper.CreateBody(physic_World, colis);
NewtonWrapper.BodySetMatrix(body, ref mat);
NewtonWrapper.ReleaseCollision(physic_World, colis);
NewtonWrapper.BodySetLinearDamping(body, lin_damp);
Vector3 AngDamp = new Vector3(0.1, 0.1, 0.1);
NewtonWrapper.BodySetAngularDamping(body, ref ang_damp);
// I do no find the function to set auto sleep off yo unee to implmenet function
void NewtonBodySetAutoSleep (const NewtonBody* body, int state);
// you need to set the inertia matrix by using funxtion,
// NewtonConvexCollisionCalculateInertialMatrix (const NewtonCollision* convexCollision, dFloat* inertia, dFloat* origin);
// setting the inertia to 1.0 causes the body to move in a very unrealistic way,
// and because auto step was on then the auto frezze code kicks in and the bodis stop when eth lina moment reach zero, sicne the angual momentum is very, very small.
NewtonWrapper.BodySetMassMatrix(body, mass, 1, 1, 1);
NewtonWrapper.BodySetMaterialGroupID(body, 1);
return body;
}

Users browsing this forum: No registered users and 208 guests