How to get access to wheels in vehicle model

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
blackMasoon
Posts: 149
Joined: Wed Sep 09, 2009 4:57 pm
Contact:

How to get access to wheels in vehicle model

Post by blackMasoon »

Hello. I have a problem with accessing to a vehicle mesh wheels. I have a obj vehicle file which should have wheels as children and I can't access them f. ex. to rotate the wheels. In other engine there was an example of accessing wheels by getting children nodes of the mesh. In Irrlicht getJointCount() or getChildren().getSize() returns 0. How can I access those wheels?

Here's the example in min3D engine based on open GL ES:
http://www.rozengain.com/blog/2010/05/1 ... r-android/


It's the same mesh.
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

OBJ cannot store skeletal information, so getJointCount will always return 0. Instead of making the separate parts of the mesh into children, irrlicht makes them separate meshbuffers. I'd recommend just keeping them separate all together and setting them as children in the engine.
blackMasoon
Posts: 149
Joined: Wed Sep 09, 2009 4:57 pm
Contact:

Post by blackMasoon »

But even irrEdit shows one wheel in the (0,0,0) position, so it means that there should exist a way to access those wheels in irrlicht in this file.... It seems like these are few separate objects in one obj file so my question is howto access them?
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

Like I said above, they're put into separate meshbuffers (they're in the same mesh, meshes contain usually quite a few mesh buffers). You can access the meshbuffers individually and transform them
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Since rotatin ghte wheel most often does not require to change the geometry, it would even be enough to alter the texture matrix of the wheels' materials.
blackMasoon
Posts: 149
Joined: Wed Sep 09, 2009 4:57 pm
Contact:

Post by blackMasoon »

Well... I can't do anything with texture 'cause there is one for whole model (including wheels).

And next bad news is... that the getMeshBufferCount() returns 1 so it looks like there is no access to those wheels from there...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, usually things are put into groups when exported to .obj. Since the loader seems to ingore the groups for now, you could set the scene parameter such that the groups are correctly loaded into separate mesh buffers. If there are even no groups in the file, you're completely lost with this mesh.
Even if you only have one texture, you can still use texture matrix, as it works per mesh buffer. But separate meshbuffers are a must.
nespa
Posts: 167
Joined: Wed Feb 24, 2010 12:02 pm

Post by nespa »

make the wheels as separate meshes (separated 3D models) and then make them as children of the vehicle mesh.
zester
Competition winner
Posts: 52
Joined: Sun May 01, 2011 6:50 am

Post by zester »

Even better would be to make the tires and the rims separate meshes. Parent the rims to the
car and the tires to the rims then have your tires rotate fast in one direction and your rims
rotate slow in the opposite direction. And wahala your gangster with spinners!!!! lol

And cue the music...
http://www.youtube.com/watch?v=ip0vsLelVYY
Post Reply