ContactPoint update

Toby

30-11-2006 10:41:00

Hi, I experiment a strange comportement when I get contact point.
Then a shapeGroup that contains first my body actor and four wheels.

When my actor does not move wheel are at good position but when my actor move, contact point of wheels seams to be late.
Distance between body actor and fronts' wheels is smaller. And with rears' wheels taller.


NxWheelContactData contactData;
NxShape* ContactShape = mWheels[i].mWheel->getContact( contactData );
if(ContactShape != NULL)
{
Vector3 mDirection = mBody->mNode->getWorldOrientation().Inverse() * (NxTools::convert(contactData.contactPoint - mBody->mActor->getGlobalPosition()));
float mDistance = mDirection.length();
mWheels[i].mNode->setPosition(mWheels[i].mInitialLocalPos.x, 0.5f -mWheels[i].mInitialLocalPos.y + mWheels[i].mWheel->getRadius() - mDistance, mWheels[i].mInitialLocalPos.z);
}
else
{

mWheels[i].mNode->setPosition(mWheels[i].mInitialLocalPos.x, mWheels[i].mInitialLocalPos.y + mWheels[i].mWheel->getSuspensionTravel() - mWheels[i].mWheel->getRadius(), mWheels[i].mInitialLocalPos.z);

}


Then suspension react well, but when we accelerate front well up and rear well down.
Must I introduce velocity in my calcul? I think no.

Thanks for your reply.

<~Creatine~>

30-11-2006 10:49:41

Why don't you use nxOgre::Prefabs::vehicle and nxOgre::Prefabs::vehicleBlueprint?


nxOgre::Prefabs::vehicleBlueprint* mp;
for (int a = 0; a < 4; ++a) mp->mWheels[a].mWheelSuspension = 0.8;

nxOgre::Prefabs::vehicle* car;
float drive_velocity = car->getDriveVelocity();

Toby

30-11-2006 10:57:35

Then when I started my project last release not implemented very well vehicle. Prefabs was not finished and suspension was not implemented.
An dnow in last release I do not see any prefabs. And I am not sure vehicle is totaly implemented. Mine is, just this problem.
If you can indicate to me what file contains Prefabs::vehicle?

And I see it in nxOgre_character.cpp
void character::simulate(float _time) {

mMoveVector = NxVec3(0,0,0);

switch (mState) {
case WALKING: simulateWalking(_time); break;
case SWIMMING: break;
case FLYING: break;
case JUMPING: simulateJumping(_time); break;
case FALLING: simulateFalling(_time); break;
case LADDER: break;
case vehicle: break;
case NONE: break;
}


As you see vehicle do nothing yet.

Toby

30-11-2006 11:09:45

Hum, I am confuse. I though I am using lastest NxOgre because on web site it is write last: NxOgre 0.4 RC2 but when we follow link there are 0.5 preview 2.0
And in it there are vehicle prefabs. I will test it and see if suspension are well implement now.

:lol:

I have earn many things in code my self. Thanks

betajaen

30-11-2006 11:10:03

I made the hard decision to take out prefabs from the core library a while back. They will be featured in just the tutorial code.

Parts of it still exist though in a way, i.e. the WheelShape still exists, and can be implemented via the second set of code in this post

And once you get the wheel shapes done, you can just make up the rest of the car yourself.

That is if you want to upgrade to RC2.0

Toby

30-11-2006 11:20:41

Ok, but why in nxogre web site we can see a stable nxogre 0.5 preview 2.0 ? and when we download it is a 0.4 RC2?

This does not answer to my original question. I am using 0.4 RC2. And I implement my own vehicle class but I have a little problem in get contact point or with global position of actor that does not update quickly.

Thanks for your answer, even if you do not know why.

Toby

01-12-2006 14:46:00

I made some change but same problem appear.

This is a short video which represent what I experiment.
http://artcardeus.free.fr/media/Movie/wheelInLate.avi

How you can see distance between contact point and wheel's globalPosition grow up. I try to also to multiply by time since last frame at each calcul.

Any idea?


If not tell me why. do you understand my question? ... :roll:

<~Creatine~>

02-12-2006 11:08:11

Well the latest nxOgre vehicle class work perfectly. ;) You can integrate more things in it if you want.