_maxvelocity

magura

10-05-2006 02:30:35

Betajaen am I right in assuming that _maxvelocity of the vehicle prefab currently has no effect? Its quite integral to the simulator im working on - mobility scooters (dont laugh, its a final year project :p). Basically i want to make sure that the wheels dont go past a certain speed (10km/h) to a certain extent - for example this might not hold true down a very steep hill :)

</evil>

currently, the _maxvelocity flag doesnt seem to be affecting speed at all - and I'm completely rev limited, so if i go down even a shallow incline, the speed picks up above the limit.

There is a large commented block in the vehicle::simulate method, wondering if thats it. Any idea's/suggestions on how I should go about this? I'll give it a go.

magura

10-05-2006 03:26:34

On a related topic, is there a current driveshaft/axel speed value?

currently im using


float fWheelDistancePerMinute = m_objScooter->GetVehicle()->_calculateWheelsRPM() * MSS3D::g_fWheelCircumference;
int nDistancePerHour = fWheelDistancePerMinute/60/1000; // should now be km/h


that seem right?
the values im getting are not right.

betajaen

10-05-2006 09:36:17

I honestly don't know.

All of the vehicle prefab is out of the ray casting car demo in PhysX and some of it isn't implemented (i.e. the gear system as you might have found out already), and it's been a long time since I've been anywhere near the vehicle code. I wish I could help you out further.

:(

magura

10-05-2006 11:04:22

im currently updating from preview 2, ogre sdk 1.0.6 to cvs versions of ogre and nxogre. Will see how that goes :)

celic

11-05-2006 08:42:05

hi, betajaen!

I also have played with the vehicle prefab classes and have a little question.
Is it possible to attach an Ogre entity to the wheels?
IIRC, the wheels are PhyX objects which don't have many to do with nxOgre, so there are no nxOgre::body'ies to attach to.

betajaen

11-05-2006 11:14:59

Yep, there is a Scene Node for each of the wheels, it automatically changes position every frame to suit the NxWheelShape.

[Edit]

Oh you're using the CVS?

It's the rewrite code and there isn't a node for it (my computer exploded when I was writing that code). If you fancy butchering the source for it, it's pretty easy to add in:

- Create a scene node "mNode" in the wheel class, and then create the scene node in the wheel's constructor.

- Just set the node position in vehcile::simulate:- mWheel.mNode->setPosition(NxTools::convert(mWheel.mWheel->getPosition() )

Having the old vehicle code source handy will certainty help you along, it's the same really.

celic

11-05-2006 13:18:34

Yes, I'm using the CVS version of nxOgre.
Thanks a lot for the tip, I don't think it will be difficult to add this code. :)

But what I really want to achieve is to simulate the vehicle's suspension. :?
As I'm not very familiar with physics in general, I don't know how should it be done. I think to connect the vehicle body and the wheels with joints.
What do you think, will this work?

Thanks again! :wink:

betajaen

11-05-2006 13:32:40

It does have a suspensionthe NxWheel has one built in but it's very stiff, but obviously you can adjust it around.

But your wheel<->body<->joint<->car idea would work also.

magura

12-05-2006 08:44:27

ive updated (finally got it working with cvs nxogre and dagon rc2), and still speed limit (mLocalVelocity in the new vehicle class) isn't doing anything - I'll give it a shot implementing the limit myself. Any hints?

btw i like the new suspension implementation - very nice to watch in action. It's just a shame the vehicles im working with arent as graphic/eventful in this regard :)

Im finding bodyroll an issue once i get past a certain low speed - i suspect i may be able to fix it with suspension values - centre of mass doesnt seem to be working for me like it did in the old nxogre implementation.

by the way, i took a large constant downward force (30000 or so) out of the vehicle::simulate() method, as it was causing glitches. I suspect this may also be related.

magura

12-05-2006 09:41:17

think ill have to look through the novodex raycastcar sample

betajaen

12-05-2006 09:42:20

Sadly no. But like I said the code is from the Raycast car demo which probably best place to look at.

I found adding the large force down stabilised the car when going around corners, it's a naughty hack but it seemed to work :wink:

If you make any sigificant progress with the vehicle class, and you're happy with it. I'd love any new changes you make for it. :D

magura

12-05-2006 10:20:05

ill give it a go and let you know what I come up with