Game Development Community

How do I change vehicle model on the fly?

by EricCartman · in Torque Game Engine · 08/20/2002 (9:38 pm) · 4 replies

I have tried:

%client.player.dataBlock = "newCar"

where "newCar" is a dataBlock with a different vehicle model. I have tried at startup and it works. However, when I tried to get it change model in game, it doesnt change?

Do I need to tell the server to do a refresh or something?

thanks in advance.

#1
08/28/2002 (2:39 am)
The function I believe your looking for is the setDatablock(%block); function

Say you have a car datablock called "RoughRider"
Now before we change the block, we need to get a couple of attributes, like health and energy.

%energyLevel = %player.getEnergyLevel();
%health = %player.getDamageLevel();
//Set the datablock here
%player.setDataBlock(RoughRider);
//Apply the old vehicles health and such
%player.setEnergyLevel(%energyLevel);
%player.setDamageLevel(%health);

That should take care of everything. remember though that you cannot change a datablock of 2 different types,
like a car into a player. Have fun and I hope this helps.
#2
11/22/2004 (12:34 pm)
Is there a way to just change the shapeFile? is the a %player.setShapeFile(someDts.dts)?
-Ken
#3
08/04/2006 (4:56 pm)
Hi i know is a old post, but you got any solution on this?
For my Game i wanna have different Shape Models i can change on the fly, with same animations.
I looked the last days in the Forums for a Solution but i cant find, and im sure this is something have done before.

Thx for answers^^

-Migi
#4
08/08/2006 (10:30 am)
I'm also curious about this.
Is it possible to just change the player's mesh?

Because changing the whole datablock seems like it would change alot more than the shape. Maybe having different datablocks for different 'bodies' would be best?

How do you handle different character bodies?