Caravaggio
12-06-2009, 08:21 PM
I'm trying to put together a game in MS' XNA, but it's all code and doesn't use a map editor. So I've got two choices, enter the positions of static meshes manually or code my own editor. I'm thinking it'll be faster/easier if I could just use a 3d package like c4d or max to map the world and then just find some way to create a list of the objects and their positions for use in xna, the objects themselves already being in the xna content directory.
I've never looked at coffee before, and while some things are obvious, others definitely less so. So I'm hope someone has done something like this or maybe already has. My initial idea was to just cycle through the index numbers of all the children of the main doc, but I'm having trouble finding something on index positions.
I did find this page while searching the forums...
http://www.per-anders.net/w/index.php?title=COFFEE_Object_Iteration
...so should I just not worry about cycling through index numbers and use the GetNext() funtcion?
Obviously not real code, just kind of how I'd like it to work...
main(doc,op)
{
for (i=0; i<total_objects_in_scene; i++)
{
//add object name to list...
print(doc->GetObject()[i]->GetName() + ", ");
//then translation...
print(object x position + ", "); //hopefully more like "child[i].x"
print(object y position + ", ");
print(object z position + ", ");
//and rotation...
print(object h rotation + ", ");
print(object p rotation + ", ");
print(object b rotation + ", "); //I can delete the last one manually.
}
}
So I end up with something like;
[wall, 23, 53, 453.3, 0,0,0, pillar, 357, 464, 465, 35,0,0]
(I understand writing to a file is itself problematic but it'll be fine if I can just use print to trace it all to the console window and then just control-c it.)
Any help appreciated.
I've never looked at coffee before, and while some things are obvious, others definitely less so. So I'm hope someone has done something like this or maybe already has. My initial idea was to just cycle through the index numbers of all the children of the main doc, but I'm having trouble finding something on index positions.
I did find this page while searching the forums...
http://www.per-anders.net/w/index.php?title=COFFEE_Object_Iteration
...so should I just not worry about cycling through index numbers and use the GetNext() funtcion?
Obviously not real code, just kind of how I'd like it to work...
main(doc,op)
{
for (i=0; i<total_objects_in_scene; i++)
{
//add object name to list...
print(doc->GetObject()[i]->GetName() + ", ");
//then translation...
print(object x position + ", "); //hopefully more like "child[i].x"
print(object y position + ", ");
print(object z position + ", ");
//and rotation...
print(object h rotation + ", ");
print(object p rotation + ", ");
print(object b rotation + ", "); //I can delete the last one manually.
}
}
So I end up with something like;
[wall, 23, 53, 453.3, 0,0,0, pillar, 357, 464, 465, 35,0,0]
(I understand writing to a file is itself problematic but it'll be fine if I can just use print to trace it all to the console window and then just control-c it.)
Any help appreciated.
