How to use ConvexHullModifier?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

How to use ConvexHullModifier?

Postby Auradrummer » Thu Oct 15, 2009 12:11 pm

Hello guys,

I made a noseCone to my car, and I want to attach it to the body. I don't want to create a new rigid body to it, as I don't want it to have weight or any dynamics, so, less calculations to the engine.

But, I want to make it dettacheable too. So I cannot build a compound collision.

I guessed I could make a ConvexHull with it and then set a Modifier to attach. The code is this way:
Code: Select all
 
    ship.noseConeColl = addHullCollision (ship.noseConeMeshColl, driver, nWorld, dVector (0.0f, 0.0f, 0.0f),12);
    ship.noseConeCHM = NewtonCreateConvexHullModifier (nWorld, ship.noseConeColl, 12);

And, inside the callback:
Code: Select all
    NewtonBodyGetMatrix (body, &ship.matrix[0][0]);
    NewtonConvexHullModifierSetMatrix (ship.noseConeCHM, &ship.matrix[0][0]);

The result is that no difference was noticed. The nose seems to not be there. Any tip?
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am

Re: How to use ConvexHullModifier?

Postby Julio Jerez » Thu Oct 15, 2009 1:46 pm

you got me lost, you are doing so many unhortodoxe things that I not longer can follow what you are doing.

What it is that you are doing?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: How to use ConvexHullModifier?

Postby Auradrummer » Thu Oct 15, 2009 3:04 pm

Oh Master, sorry ... inexperience is a very bad thing. :D

I'll explain what I'm doing since I started a raycast car:

I decided to make a car (again) and followed your advice: "use raycast".
So I made a car (rigid body) without wheels and suspensions and cast four rays from where should be the wheels.
By the rays I can calculate the height of each wheel should be from the ground and following your tutorial (raycast suspension) I implemented the formulas and my car flews (in this point, I started to build an airlift car, but I gave up shortly).

After this, I started to calculate the forces that appears over the car when I steer, accelerate, brake and pass over a track bump.

The acceleration and brake was easy (wihtout weight transfer). Make the car stay aligned with the ground variations wasn't too hard, as I have the suspensions forces.
But, simulating steering is far more complex because the tire frictions you know so well (this is the theme of another topic I created).

Then I made a rough steering system and added graphic wheels. But the wheels doesn't collide, because they doesn't exists in fact for the Newton engine. So, I tried to make some collision wheels. As rigid bodies increases the engine calculations, I tried to create only collisions for them, without any dynamics. I did it with compound collision. But the wheels aren't really fixed in the car, they moves up / down and steers. Because of it I tried to make a collision shape that can move together the car, but have some 'offset' movement. This is the point I'm now. I decided to make a nose cone only because is more simple than wheels.

To finish, is incredible, but the car seems that will work!
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest