Xed
11-05-2007 14:15:51
Could anybody post code of 4 wheels vehicle and it control(move back\front)?
I'd like if you post for 0.6 and 0.9 too.
Thnx.

Xed
11-05-2007 14:15:51
betajaen
11-05-2007 14:47:58
Xed
16-05-2007 19:47:52
betajaen
16-05-2007 20:27:54
NickM
17-05-2007 16:37:40
betajaen
17-05-2007 16:41:24
Xed
17-05-2007 16:44:04
betajaen
17-05-2007 16:48:46
NickM
17-05-2007 16:50:46
Xed
17-05-2007 17:06:11
betajaen
17-05-2007 17:28:05
Xed
17-05-2007 17:35:46
NickM
17-05-2007 18:32:13
carShape->addShape(new convexShape("CarCollisionModel.mesh",CarBodyMaterial));
Xed
17-05-2007 18:38:52
betajaen
17-05-2007 18:50:41
Xed
17-05-2007 18:57:52
Xed
17-05-2007 19:06:23
Xed
17-05-2007 20:11:09
betajaen
17-05-2007 20:15:17
float Speed_in_KPH = mBody->getNxActor()->getLinearVelocity().magnitude() * 3.6f;
Xed
18-05-2007 14:20:58
betajaen
18-05-2007 14:26:24
Xed
18-05-2007 14:31:56
Xed
18-05-2007 14:57:42
daedar
18-05-2007 15:13:41
Xed
18-05-2007 16:40:00
betajaen
18-05-2007 16:44:45
Xed
18-05-2007 16:51:37
betajaen
18-05-2007 16:58:17
Xed
18-05-2007 17:23:22
mBody->getScene()->getSceneManager()->getSceneNode(NAME)->scale(Vector3(10,10,10));
Ogre::Entity* entity = mActor->getScene()->getSceneManager()->createEntity(NxCreateID(mActor->getNbShapes(), mNode->getName()), meshName);
mNode->attachObject(entity);
betajaen
18-05-2007 17:36:31
mWheel->getNode()
NickM
18-05-2007 17:38:45
Xed
18-05-2007 19:06:27
Toby
19-05-2007 10:59:34
Xed
28-05-2007 12:04:55
void PLAYER::load(CAR* MyCAR)
{
//body
ELEMENTS_LIST* B=&(MyCAR->BODY);
ELEMENTS_LIST::iterator I=B->begin();
LogManager::getSingleton().logMessage("**********begin of NxOgre body");
ActorParams ap;ap.setToDefault();
NxOgre::ShapeParams shp;shp.setToDefault();
ap.nodescale=(*I).Scale;
ap.density=10.1;
ap.kinematic=false;
ap.mass=MyCAR->MASS;
ap.nodeshadows=true;
shp.mMeshScale=NxVec3((*I).Scale.x,(*I).Scale.y,(*I).Scale.z);
NxQuat NXQ;
NXQ.x=(*I).Rotation.x;
NXQ.y=(*I).Rotation.y;
NXQ.z=(*I).Rotation.z;
NXQ.w=(*I).Rotation.w;
shp.mOrientation=NXQ;
mBody=mScene->createBody(
(*I).FileName,
new MeshShape(
(*I).FileName,shp),
NxOgre::Pose(
(*I).Position,
(*I).Rotation
),
ap);
mBody->setCMassOffsetLocalPosition(Vector3(0,-1,0));
mBody->setGlobalPose(MyCAR->POSE);
//mBody->setGlobalOrientation(MyCAR->ORIENTATION);
String mParams;
LogManager::getSingleton().logMessage("**********begin of @for@");
for(++I;I!=B->end();++I)
{
LogManager::getSingleton().logMessage("**********mParams");
mParams="mesh-scale:";
mParams+=StringConverter::toString((*I).Scale);
mParams+=" orientation:";
mParams+=StringConverter::toString((*I).Rotation);
mParams+=" position:";
mParams+=StringConverter::toString((*I).Position);
LogManager::getSingleton().logMessage(mParams);
LogManager::getSingleton().logMessage("**********addShape");
mBody->addShape(new MeshShape((*I).FileName,mParams));
}
ELEMENTS_LIST* F_L=&(MyCAR->FRONT_LEFT_WHEEL);
ELEMENTS_LIST* B_L=&(MyCAR->BACK_LEFT_WHEEL);
ELEMENTS_LIST* F_R=&(MyCAR->FRONT_RIGHT_WHEEL);
ELEMENTS_LIST* B_R=&(MyCAR->BACK_RIGHT_WHEEL);
if ((F_L->empty()==true)
||(B_L->empty()==true)
||(F_R->empty()==true)
||(B_R->empty()==true)
) BOOL=false;
if (BOOL)
{
LogManager::getSingleton().logMessage("***** begin of nxOgre wheel set");
ELEMENTS_LIST::iterator a,b;
Ogre::Vector3 aa,bb;a=F_L->begin();aa=(*a).Position;b=B_L->begin();bb=(*b).Position;
mWheelSet = WheelSet::createFourWheelSet(mBody, aa, bb, MyCAR->RADIUS);
mMotor = new Motor("Motor", mScene, &mWheelSet.Drive);
mWheelSet.attachDriveShaft(mMotor);
//wheel FRONT LEFT
I=F_L->begin();
for(I;I!=F_L->end();++I)
{
LogManager::getSingleton().logMessage("******* FRONT LEFT "+(*I).Name);
mWheelSet.frontLeft->addMesh((*I).FileName);
mWheelSet.frontLeft->getNode()->setPosition((*I).Position);
mWheelSet.frontLeft->getNode()->setScale((*I).Scale);
mWheelSet.frontLeft->getNode()->setOrientation((*I).Rotation);
}
//wheel FRONT RIGHT
I=F_R->begin();
for(I;I!=F_R->end();++I)
{
LogManager::getSingleton().logMessage("******* FRONT RIGHT "+(*I).Name);
mWheelSet.frontRight->addMesh((*I).FileName);
mWheelSet.frontRight->getNode()->setPosition((*I).Position);
mWheelSet.frontRight->getNode()->setScale((*I).Scale);
mWheelSet.frontRight->getNode()->setOrientation((*I).Rotation);
}
//wheel BACK LEFT
I=B_L->begin();
for(I;I!=B_L->end();++I)
{
LogManager::getSingleton().logMessage("******* BACK LEFT "+(*I).Name);
mWheelSet.backLeft->addMesh((*I).FileName);
mWheelSet.backLeft->getNode()->setPosition((*I).Position);
mWheelSet.backLeft->getNode()->setScale((*I).Scale);
mWheelSet.backLeft->getNode()->setOrientation((*I).Rotation);
}
//wheel BACK RIGHT
I=B_R->begin();
for(I;I!=B_R->end();++I)
{
LogManager::getSingleton().logMessage("******* BACK RIGHT "+(*I).Name);
mWheelSet.backRight->addMesh((*I).FileName);
mWheelSet.backRight->getNode()->setPosition((*I).Position);
mWheelSet.backRight->getNode()->setScale((*I).Scale);
mWheelSet.backRight->getNode()->setOrientation((*I).Rotation);
}
}
}
betajaen
28-05-2007 13:29:38
Xed
28-05-2007 14:04:41
I'm guessing you have a meshShape near 0,0,0,
ghiboz
28-05-2007 14:20:46
mScene = mWorld->createScene("Main", mSceneMgr, "gravity: yes, floor: no");
Xed
28-05-2007 14:36:17
ghiboz
28-05-2007 14:38:33
2 ghiboz
Yes, I use floor.
betajaen
28-05-2007 15:37:52
Xed
28-05-2007 17:54:53
betajaen
28-05-2007 18:01:37
Xed
28-05-2007 18:21:38
daedar
28-05-2007 23:18:49
betajaen
28-05-2007 23:36:41
new WheelShape(0.5f, "material: myMaterial", "bleh");
daedar
28-05-2007 23:43:57
betajaen
29-05-2007 00:05:29
daedar
29-05-2007 03:15:51
nxScene->createMaterial("wheels")->setAll(0.01,0.01,0.01);
ShapeParams sp;
sp.setToDefault();
sp.mMaterial = "wheels";
NickM
29-05-2007 06:29:10
betajaen
29-05-2007 09:38:25
daedar
29-05-2007 10:06:32
luis
29-05-2007 11:55:25
NX_MF_DISABLE_FRICTION
material->setAll( 0, 0, 0)
you are supposed to use NxTireFunctionDesc to simulate different grip levels although I've not managed to create realistic feeling tyres with it yet, I've posted on the Ageia forum to try to get some help.
daedar
29-05-2007 12:25:56
if( wMaterial == NULL ){
NxMaterialDesc materialDesc;
materialDesc.flags |= NX_MF_DISABLE_FRICTION;
materialDesc.dynamicFriction = 0;
materialDesc.staticFriction = 0;
wMaterial = mScene->createMaterial("wheel", materialDesc);
}
...
...
...
wheels.backLeft->getNxWheelShape()->setMaterial( wMaterial->getMaterialIndex() );
wheels.backRight->getNxWheelShape()->setMaterial( wMaterial->getMaterialIndex() );
wheels.frontLeft->getNxWheelShape()->setMaterial( wMaterial->getMaterialIndex() );
wheels.frontRight->getNxWheelShape()->setMaterial( wMaterial->getMaterialIndex() );
luis
29-05-2007 13:25:09
friction_lateral_extremumSlip = 1.0
friction_lateral_extremumValue = 0.029
friction_lateral_asymptoteSlip = 2.0
friction_lateral_asymptoteValue = 0.01
friction_lateral_stiffnessFactor = 10.0e3
friction_longitudinal_extremumSlip = 1.0
friction_longitudinal_extremumValue = 0.02
friction_longitudinal_asymptoteSlip = 2.0
friction_longitudinal_asymptoteValue = 0.01
friction_longitudinal_stiffnessFactor = 30.0e3
daedar
29-05-2007 13:36:33
NickM
29-05-2007 16:30:41
ok, try these values:
the settings i posted here are the ones i use in those videos:
http://gboot.blogspot.com
Toby
29-05-2007 22:45:12
ghiboz
29-05-2007 23:15:32
Great work indeed. I will try your parameters for my car game when wheels is on grass.
Your game is fun, like offroad or supersprint were.
betajaen
29-05-2007 23:19:59
NickM
30-05-2007 06:26:52
what's the best solution to check that you're on grass??
luis
30-05-2007 08:47:19
Why would you change the tire functions when it moves onto the grass? Surely the grass material would take of the slippyness.
You could get the material from the contact then alter the tyre function to give you the feel you want from grass.
ghiboz
30-05-2007 15:42:50
Xed
31-05-2007 19:42:13
NickM
31-05-2007 22:37:01
Hi )))
3. I saw cloth in 0.9-23, so what about cloth metal?
Xed
01-06-2007 17:20:01
luis
03-06-2007 20:02:54
void Wheel::simulate(float dt) {
mWheelRollAngle += mWheel->getAxleSpeed() * dt;
while (mWheelRollAngle > NxTwoPi) //normally just 1x
mWheelRollAngle -= NxTwoPi;
while (mWheelRollAngle < -NxTwoPi) //normally just 1x
mWheelRollAngle += NxTwoPi;
mPose = mWheel->getGlobalPose();
NxWheelContactData wcd;
wcd.contactPosition = 0;
NxShape* s = mWheel->getContact(wcd);
NxReal stravel = mWheel->getSuspensionTravel(),
radious = mWheel->getRadius();
//have ground contact?
if( s )
{
mPose.t += mWheel->getLocalOrientation()*mPose.M
*NxVec3( 0.0, radious - wcd.contactPosition, 0.0 );
} else {
mPose.t += mPose.M*NxVec3( 0.0, -stravel , 0.0 );
}
NxMat33 Heading, Pitch;
Heading.rotY( mWheel->getSteerAngle() );
Pitch.rotX( mWheelRollAngle );
mPose.M = mPose.M * Heading * Pitch;
// user should take care of waking up, see Wheelset class
// mWheel->getActor().wakeUp();
}
Xed
04-06-2007 18:59:47
luis
04-06-2007 20:04:48
Where I can see how to setup my wheels looks like ice(and other f.e. for grass, road)?
if the car slides too much for you, try changing the lateral stiffness from 10e3 to 20e3 or something higher
Xed
18-06-2007 08:56:52