A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Alexisfire » Fri Nov 12, 2010 7:00 am
Hi!
I'm actually working on a small project for my university, what i've to do is a little game where you can drive a floating car on a track(like
F-zero game).
The question is...how should i implement the floating parameter?
Any idea? Actually i'm trying with the PlayerController Class...but i'm not sure, the rayCastVehicle also don't seem the right choise but maybe i'm wrong.
Any help would be really appreciate
Thanks!
Alex
-
Alexisfire
-
- Posts: 5
- Joined: Fri Nov 12, 2010 6:56 am
by JernejL » Fri Nov 12, 2010 9:59 am
Looks a lot like a raycast car with no tires.
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by Alexisfire » Fri Nov 12, 2010 10:21 am
Yes?
Great!
That's exactly what i was thinking to implement, thank you very much

-
Alexisfire
-
- Posts: 5
- Joined: Fri Nov 12, 2010 6:56 am
by Alexisfire » Fri Nov 12, 2010 11:25 am
Mmmm, something is not clear, without tires you mean, invisible or just "No tires"?
In the second case, what should i do?
If i try to add a suspension without connecting it to a tire, everythings work fine...but i've got a crash when i close the app.
- Code: Select all
//Entity body e Node
Auto* car;
Entity* carEnt;
OgreNewt::Body* carBody;
SceneNode* parentNode;
Node* node;
//Create the main car body
carEnt = mSceneMgr->createEntity(pName,cName+".mesh");
parentNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
parentNode->attachObject(carEnt);
OgreNewt::ConvexCollisionPtr col(new OgreNewt::CollisionPrimitives::ConvexHull(world,carEnt,0));
carBody = new OgreNewt::Body(world, col);
//Base mass on the size of the object
Real mass = 100.0f;
//Calculate the inertia, based on box formula and mass
Vector3 inertia, offset;
col->calculateInertialMatrix(inertia,offset);
carBody->attachNode(parentNode);
carBody->setMassMatrix(mass,mass*inertia);
carBody->setCenterOfMass(offset);
carBody->setStandardForceCallback();
carBody->setPositionOrientation(Vector3(0,50,0),Ogre::Quaternion::IDENTITY);
car = new Auto(carBody);
// for now just to get it going
Ogre::Real friction = 0.1f;
Ogre::Real suspensionLenght = 0.2f;
Ogre::Real susSpring = 100.0f;
Ogre::Real susShock = 0.0f;
Real width = 0.38;
Real radius = 0.33;
car->AddSingleSuspensionTire(carBody,Vector3(-0.625456f, -0.296697f, -1.235474f),Real(10),radius,width,friction,suspensionLenght,susSpring, susShock);
car->AddSingleSuspensionTire(carBody,Vector3( 0.625456f, -0.296697f, -1.235474f),Real(10),radius,width,friction,suspensionLenght,susSpring, susShock);
car->AddSingleSuspensionTire(carBody,Vector3( 0.625456f, -0.296697f, 0.818093f),Real(10),radius,width,friction,suspensionLenght,susSpring, susShock);
car->AddSingleSuspensionTire(carBody,Vector3(-0.625456f, -0.296697f, 0.818093f),Real(10),radius,width,friction,suspensionLenght,susSpring, susShock);
return car;
*Edit*
Solved!
It seems that, even if you don't create tires, you still have to set they're number in the constructor, now everything work fine!!
Thank you again!
-
Alexisfire
-
- Posts: 5
- Joined: Fri Nov 12, 2010 6:56 am
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 212 guests