Author Topic: How to setup nodes on a vehicle and hide/unhide them via script?  (Read 1266 times)

I'd like some variations for a vehicle I'm making, and I've heard of people using the same model with different nodes showing to make a police car, different cargo, etc. How do I set up a node and hide/unhide it for each one on?
« Last Edit: February 23, 2012, 05:32:42 PM by Nasoa »

I believe what people actually do is animate the vehicle and play the correct animation to hide/show each thing. If you're only going to be having one 'node' visible at a time, you can use the following to play an animation:

%vehicle.playThread(0,"animationName");

I can't really help you with animating though, but I can tell you it needs a "root" animation for the default vehicle.

%obj.hideNode(nodename);
%obj.unhideNode(nodename);

I believe what people actually do is animate the vehicle and play the correct animation to hide/show each thing. If you're only going to be having one 'node' visible at a time, you can use the following to play an animation:

%vehicle.playThread(0,"animationName");

I can't really help you with animating though, but I can tell you it needs a "root" animation for the default vehicle.

Don't listen to him.

%obj.hideNode(nodename);
%obj.unhideNode(nodename);

This man is right.

Also, for an example here's a part of the Blocko Sedan script:

Code: [Select]
function BlockoSedanVehicle::onAdd(%db,%this)
{
%this.hideNode(taxiacc);
%this.hideNode(policeacc);

parent::onAdd(%db,%this);
}

What this part does is the following: when the car is added it hides the taxi accessory node (taxiacc) and the police accessory node (policeacc). Had it not been for these scripts, the regular sedan would spawn with having both of those accessories visible.

For the taxi and the police version only one of the nodes are hidden, and the other one is unhidden.

Thanks a bunch, this will be really helpful.

So you are still working on the car?