Need for speed car choosing

What is a good way to implement "Need for speed" type car choosing menu?



when clicking right / left button, new car will shift from left to right quickly and rotating.



One extremely straight forward way to do this would be to put all models into one node, but with a position around a circle from local (0,0,0) and then just rotate the main node when pressing <- or ->. In reality, NFS loads the model in real time when you press the key, and just displays the rotation as a diversion for the loading time.

what I understand is 1 model only can assign to 1 node.



since you read model into binary and then you get "Node" object.



how to load multiple models into 1 Node object? 



and how to rotate the model inside the "Node" object?



Thanks !

tobycraftse, I am not sure if i understood your question right. If I did, this is the solution to your "problem":


Node cars = new Node("all cars");
cars.attach(car1);
cars.attach(car2);
//add as many cars as you wish here...


If this is what you need, you are missing an understanding of the most basic concepts behind jME, and should start reading the user's guide and tutorials over on the wiki right now!

I see, what you are saying is



set cars like following picture where all black dot is cars

http://www.oniva.com/upload/1356/cir.jpg



then you rotate the cars along the Z axis by 90 degree like the following:



will that work?



Node cars = new Node("all cars");
cars.attach(car1);
cars.attach(car2);
//add as many cars as you wish here...
        Quaternion rotate3 = new Quaternion();
        // angle in radian no degree
        rotate3.fromAngleAxis(-1.57f, new Vector3f(0, 0, 1));
        cars.setLocalRotation(rotate3);




You'd want to "work your way" to your 90 degree rotation so you could use a controller or some code in the update() method to calculate the amount to rotate per frame to achive the deisred speed.



Otherwise you'll just "flip" from one car to the other and lose the "cars on a platter" effect.