Questions
by Dylan Nicholson · in Torque Game Engine · 06/12/2007 (10:03 pm) · 10 replies
Already posted to "Getting started" group, but not getting any responses there...
I tried to use the demo game as a starting point for my own, including the features.ter file in the missions directory. But this appears to contain filename references that are not truly relative - they include the 'demo' directory in the name, hence I can't copy it into a new game. Obviously I can edit it in a binary editor, providing my new game also uses a 4-letter name, but surely there's a better way?
Also, is there a version of world editor available that allows you to resize the window? I can't even adjust the splitter between the preview pane and the properties pane, hence I can't read most of the property values without selecting each one individually and scrolling through it.
Lastly...I've used MilkShape to convert a 3ds file into a .dts file, but because I want to use it as a vehicle (a boat!), it appears it has to have "collision details" (without it, it simply causes the Torque Engine exe to crash...only by running it under the debugger did I actually figure out what was wrong). Actually, I don't care at all about collisions, because the paths of the boats are pre-determined, so maybe I shouldn't be using a Vehicle type (?), but either way, I would like to know if it's possible to add a collision mesh to a model using MilkShape.
TIA
Dylan
I tried to use the demo game as a starting point for my own, including the features.ter file in the missions directory. But this appears to contain filename references that are not truly relative - they include the 'demo' directory in the name, hence I can't copy it into a new game. Obviously I can edit it in a binary editor, providing my new game also uses a 4-letter name, but surely there's a better way?
Also, is there a version of world editor available that allows you to resize the window? I can't even adjust the splitter between the preview pane and the properties pane, hence I can't read most of the property values without selecting each one individually and scrolling through it.
Lastly...I've used MilkShape to convert a 3ds file into a .dts file, but because I want to use it as a vehicle (a boat!), it appears it has to have "collision details" (without it, it simply causes the Torque Engine exe to crash...only by running it under the debugger did I actually figure out what was wrong). Actually, I don't care at all about collisions, because the paths of the boats are pre-determined, so maybe I shouldn't be using a Vehicle type (?), but either way, I would like to know if it's possible to add a collision mesh to a model using MilkShape.
TIA
Dylan
About the author
#2
06/14/2007 (5:26 pm)
There is also a resource you can implement into the engine that removes the hard-coded, non-relative paths for terrains, interiors, and more....
#4
If you follow the directions in this resource, you'll find a lot of your problems solved for future development.
06/14/2007 (7:56 pm)
Relative Paths for Terrain TexturesIf you follow the directions in this resource, you'll find a lot of your problems solved for future development.
#5
The model I have for my boat is at the wrong orientation. But it seems that if I make it a player, I can't rotate it other than around the z axis - is this correct? I assume it needs to be a player to follow a path object...although I'm a bit murky on this.
Unfortunately I don't have any tools that will allow me to rotate the model to the proper orientation and save it out to a new DTS file...would it be difficult to write a quick utility that read in a DTS, rotated it and saved back out a new DTS?
07/02/2007 (5:30 pm)
Thanks for that...a new question...The model I have for my boat is at the wrong orientation. But it seems that if I make it a player, I can't rotate it other than around the z axis - is this correct? I assume it needs to be a player to follow a path object...although I'm a bit murky on this.
Unfortunately I don't have any tools that will allow me to rotate the model to the proper orientation and save it out to a new DTS file...would it be difficult to write a quick utility that read in a DTS, rotated it and saved back out a new DTS?
#6
class FixShape : public DTS::Shape
{
public:
static void do_transform(DTS::Mesh& mesh)
{
mesh.rotate(DTS::Quaternion(DTS::Point3D(1, 0, 0), -90.0 * 3.141592 / 180.0));
}
void transform()
{
std::for_each(meshes.begin(), meshes.end(), do_transform);
}
};
int _tmain(int argc, _TCHAR* argv[])
{
FixShape shape;
{
std::ifstream ifs(argv[1], std::ios_base::binary);
shape.read(ifs);
}
shape.transform();
std::ofstream ofs((std::string(argv[1]) + ".out").c_str(), std::ios_base::binary);
shape.save(ofs);
return 0;
}
Although note it took quite a lot of fixing of the DTSSDK library for it work - for a start it didn't even read in the material info, so trying to use the saved DTS caused an assertion in the engine.
07/03/2007 (12:02 am)
Well I did it...with the following code I was able to apply the transform to the mesh(es) in my DTS:class FixShape : public DTS::Shape
{
public:
static void do_transform(DTS::Mesh& mesh)
{
mesh.rotate(DTS::Quaternion(DTS::Point3D(1, 0, 0), -90.0 * 3.141592 / 180.0));
}
void transform()
{
std::for_each(meshes.begin(), meshes.end(), do_transform);
}
};
int _tmain(int argc, _TCHAR* argv[])
{
FixShape shape;
{
std::ifstream ifs(argv[1], std::ios_base::binary);
shape.read(ifs);
}
shape.transform();
std::ofstream ofs((std::string(argv[1]) + ".out").c_str(), std::ios_base::binary);
shape.save(ofs);
return 0;
}
Although note it took quite a lot of fixing of the DTSSDK library for it work - for a start it didn't even read in the material info, so trying to use the saved DTS caused an assertion in the engine.
#7
07/03/2007 (12:32 am)
Another thing...I'm using an AIPlayer to cause an object to follow a path, but it seems such an object requires a dts file that defines animation threads...my boat is just a static object. So is AIPlayer the wrong thing to use?
#8
Also, I do not believe you have to declare animations for an AIPlayer object.
Otherwise, nice work-around.
07/03/2007 (5:16 am)
Dylan, you might want to remove that code since this is a public forum, and posting engine code is not allowed.Also, I do not believe you have to declare animations for an AIPlayer object.
Otherwise, nice work-around.
#9
Yes, I got my boat DTS to work as an AIPlayer object, thanks.
07/03/2007 (2:44 pm)
That's not engine code - it's my own.Yes, I got my boat DTS to work as an AIPlayer object, thanks.
#10
If I adjust the density of the boat to exactly match the amount it is submerged in the water (which is a real pain), I can get the mBuoyancy value to 1, which is supposed to prevent gravity, except there's a bug in the engine that it doesn't calculate the buoyancy before the first gravity calculation, so the net Z velocity is still non-zero. I fixed this by having it call updateContainer() on the first call to player::setTransform(), but now it seems the boat won't move in the x-y plane - it appears that only does this if it believes the item is on a surface - which of course it isn't! So maybe I need to be using a hover vehicle or something completely different? Vehicles are a problem because they require collision meshes, which I don't have, but if that's the only option I'll go with it.
And like I said, ideally the boat will move up and down with the wave motion, but if that's too hard I'll just make the wave motion sufficiently subtle for it not to be a problem.
07/04/2007 (1:30 am)
New problem: I've changed from using a water texture on a flat terrain, to using a water object on a mountainous terrain - but the boat sinks to the bottom!If I adjust the density of the boat to exactly match the amount it is submerged in the water (which is a real pain), I can get the mBuoyancy value to 1, which is supposed to prevent gravity, except there's a bug in the engine that it doesn't calculate the buoyancy before the first gravity calculation, so the net Z velocity is still non-zero. I fixed this by having it call updateContainer() on the first call to player::setTransform(), but now it seems the boat won't move in the x-y plane - it appears that only does this if it believes the item is on a surface - which of course it isn't! So maybe I need to be using a hover vehicle or something completely different? Vehicles are a problem because they require collision meshes, which I don't have, but if that's the only option I'll go with it.
And like I said, ideally the boat will move up and down with the wave motion, but if that's too hard I'll just make the wave motion sufficiently subtle for it not to be a problem.
Associate Matt Fairfax
PopCap
No, there isn't a version that resizes but you *can* edit it in the Gui Editor to match your needs.
A quick search of "vehicles milkshape" in the resources turned up this excellent tutorial:
4/6/8 wheel vehicle creation in Milkshape 3D