FlyingVehicle vs. Player class
by Eric den Boer · in Torque Game Engine Advanced · 02/26/2009 (2:53 am) · 4 replies
Dear all,
Yesterday I received my Torque books (awesome!). However I'm left wondering with a small question... what's the best thing to do when you wish to create a player that's flying an aircraft?
Create a FlyingVehicle instance and build up the FlyingVehicle-datablocks? Or should I do that with a Player class instead?
Can both classes be controlled by the user?
Thanks in advance!
Yesterday I received my Torque books (awesome!). However I'm left wondering with a small question... what's the best thing to do when you wish to create a player that's flying an aircraft?
Create a FlyingVehicle instance and build up the FlyingVehicle-datablocks? Or should I do that with a Player class instead?
Can both classes be controlled by the user?
Thanks in advance!
#2
So it's possible to set a FlyingVehicle as a player-controlled object, i.e. the Player?
03/04/2009 (1:38 am)
Sorry for my late reply.So it's possible to set a FlyingVehicle as a player-controlled object, i.e. the Player?
#3
You would change that with a call to new FLyingVehicle, and make the dataBlock point to a valid FlyingVehicleData
03/04/2009 (9:06 am)
Yep, sure is. Inside of game.cs take a look at function GameConnection::createPlayer(), more specifically at this area:// Create the player object
%player = new Player()
{
dataBlock = PlayerBody;
client = %this;
};You would change that with a call to new FLyingVehicle, and make the dataBlock point to a valid FlyingVehicleData
// The player is a vehicle!
%player = new FlyingVehicle()
{
dataBlock = ScoutShip;
client = %this;
};And you may want to change your control scheme to make it more suitable for vehicle controls, but this should get you started in the right direction.
#4
03/04/2009 (12:55 pm)
Thank you :) We got the model into the game!
Associate Michael Hall
Distracted...
Your "stock" vehicle choices are: wheeled, hover, and flying. There are several threads and/or resources that show how to set up datablocks for all of them, along with various control & mounting schemes.