Ok, I have created my little smoke particle creator code, it's working decent enough... basically while the vehicle is at origin I set the smoke (a texture on x number of planes) to come out of where the exhaust is on top of tractor, works great. I can make it move with the tractor in a straight line easy enough, but getting it to rotate as the tractor rotates is the hard part... To make the tractor drive in the direction of its rotated angle, here is my code:
move_vector = vehicle.getXAxis();
move_vector.x = move_vector.x * delta_x;
move_vector.y = 0;
move_vector.z = move_vector.z * delta_x;
vehicle.translate(move_vector);
vehicle_wheels.translate(move_vector);
The wheels and tractor are imported together but are two objects. The tractors pivot point is the wheels original pivot point. (Does this pivot point translate as the wheels move by the way?)
for(int ii=1; ii<max_smoke; ii++) {
smoke[ii].translate(move_vector);
}
That moves the smoke well enough that it's moving down the track with the tractor, however it's not being rotated to stay right over the exhaust pipe of tractor. I simply rotate the tractor with rotateY when I am rotating. With not changing the smokes pivot point, it just rotates around its own center of course, which doesnt help. Setting it's pivot point to the wheels makes it go crazy even when not trying to rotate it... so I am at a lost as to how to keep it right over the exhaust.
I wish there was a way to set something to the relative coordinates of the object, and not global world. There's not an easy way to do something like that is there? To always set it's position to be at a certain position on the tractor?
Thanks for any help!