Switching cars...

And i don’t mean just the models. I’m currently using the vehicle wrapper setup. What I would like is that when you press another key, or a property value is reached, the car will change from one car to another, and change the scripts that it is using. So, for example, you have a normal compact car like a Honda, then when Property “Switch” reaches 2, it switches to a riding lawn mower. These two vehicles are completely different and require a new setup script and a new drive train physics. I would really like some help. I can attempt to make this clearer if you don’t understand. Please post a blend file if you do have a solution though…

  • You could remove the first car with end object actuator and create the second car with add object actuator
  • You could switch to a scene with the second car
  • You could hide the first car (below the floor, behind a wall?) and show the second car
  • You could change the camera from showing the first car to show the second car
  • You could build your car model in a way that it can switch (meshes/script logic) between cars.
  • etc.

I hope it helps

I figured out a way that works. However,

  • With the car wrapper tutorial, the add and remove actuator doesn’t work. (I tried)
  • With what i was doing needed the cars to be in the same scene.
  • Not quite sure what you mean by hide… (I understand the concept, not the method)
  • If you have the camera setup like that, it requires 2 maps, which would severely lag on the target computer.
  • I did build it that way, and that is part of my solution. However, the main problem with that is i needed to change the wheel script.

SO! What I did, was at the beginning of the scene, instead of immediately starting the script, I set it to start when I pressed 1 or something, OR, if you pressed 2, a different setup script ran. (If you knew about the vehicle wrapper tutorial you would understand better…)

Could having two sets of properties and depending on the init button and (only one script running) the script can setup acording to the set of properties work?

I do not see a problem with the end object actuator. You just need to end all parts of the car (body+tires).

I tried to add a car with the add object actuator. That is no problem as well.
You can add all parts at the same position as the tires position is set within the script. Make sure that all parts of the car are added (body+all tires) otherwise blender might crash.
As the script contains the objects names you have to use a separate script for each car.

you could try the states system fro the different drivetrains

@Joe_Stevens
You are right, the endObject on the wheels let Blender crash. I tried to remove the constraint first, but this does not work (according to the documentation http://www.tutorialsforblender3d.com/GameModule/ClassKX_PyConstraintBinding_4.html). For me blender crashes after removing the wheels of one vehicle.
With a little change it is easy to have any number of added cars. But removing seems to be a problem.