Ok, this time with a bit more program code :)
First about the object files:
Yes, I scaled the objects but again .. all of them in the same way with
this tags in each of the .spr files of the objects.
<hardmove>
<matrix>
<scale x="0.14" y="0.14" z="0.14" />
</matrix>
</hardmove>
Additionally each of the .spr files has the tags <zuse /> and
<priority>object</priority>.
The rest is just the normal stuff.
Now about the program code:
The following part is for loading the meshes:
csString object_export_path = csString("/lib/thdata/");
iBase* parentResult;
if(!csp_loader->Load(object_export_path + this->parent_object_file +
".spr", parentResult))
csApplicationFramework::ReportError("Error couldn't load object:
" + this->parent_object_file + "!");
csRef<iMeshFactoryWrapper> parent_factory =
scfQueryInterface<iMeshFactoryWrapper>(parentResult);
if(parent_factory){
this->mtbWrapper = csp_engine->CreateMeshWrapper(parent_factory,
this->parent_object_file, thTrack->room, csVector3 (0, 23, 0));
this->parentState =
SCF_QUERY_INTERFACE(this->mtbWrapper->GetMeshObject(), iSprite3DState);
this->parentState->SetAction("stand", false);
}
for(int i=0 ; i<43 ; i++){ // runs through the array
"object_files" which contains the .spr filenames
iBase* result;
csString obj_filepath = csString(object_export_path +
this->object_files[i] +".spr"); // generates the VFS path of the
.spr file
if(!csp_loader->Load(obj_filepath, result))
csApplicationFramework::ReportError("Error couldn't load
object: "+obj_filepath+"!");
csRef<iMeshFactoryWrapper> ff =
scfQueryInterface<iMeshFactoryWrapper>(result);
if(ff){
this->mtbChildren[i] = csp_engine->CreateMeshWrapper(ff,
this->object_files[i], thTrack->room, csVector3 (0, 0, 0));
this->spstate[i] = SCF_QUERY_INTERFACE
(this->mtbChildren[i]->GetMeshObject(), iSprite3DState);
this->spstate[i]->SetAction("stand", false);
}
this->mtbChildren[i]->QuerySceneNode()->SetParent(this->mtbWrapper->QuerySceneNode());
// sets the just loaded mesh as a child of this->mtbWrapper
}
Setting up the collision detection system:
this->csp_cdsys = csQueryRegistry<iCollideSystem>(GetObjectRegistry());
if(!this->csp_cdsys) return ReportError("Failed to locate CD system!");
csColliderHelper::InitializeCollisionWrappers(this->csp_cdsys,
this->csp_engine);
this->collider_actor.SetCollideSystem(this->csp_cdsys);
this->collider_actor.SetEngine(this->csp_engine);
csVector3 legs(0.2f, 0.3f, 0.2f);
csVector3 body(0.2f, 1.2f, 0.2f);
csVector3 shift(0.0f, -0.4f, 0.0f);
this->collider_actor.InitializeColliders(this->mtbWrapper, legs,
body, shift);
Moving the "parent mesh":
this->collider_actor.Move(elapsed_time / 1000.0f, 1.0f, pos,
csVector3(0));
As mentioned before, loading the mesh objects works fine.
They are also displayed by the engine.
Just those six meshes make it somehow impossible to move the
"collider_actor".
I hope I didn't forget something.
Thanks a million for your help!
Jorrit Tyberghein wrote:
> Are you scaling the meshes in any way? Is there anything you're doing
> special? Care to show us a bit more relevant code? i.e. all code where
> you setup the collider actors and the meshes?
>
> Greetings,
>
> On 1/31/07, Thomas Teufel <[EMAIL PROTECTED]> wrote:
>> Those sprites are moved with Crystal Space C++ code by a collider actor.
>>
>> Here a more exact description:
>> I just move one iMeshWrapper object by the collider actor.
>> All the other sprites are set as children of this iMeshWrapper with
>> this code:
>> spriteObj->GetSceneNode()->SetParent(parentObj->GetSceneNode());
>>
>> There are six out of 43 sprites that shield the ability to move
>> parentObj in world space.
>> All of those 43 sprites are loaded within one loop. So the code is
>> exactly the same.
>>
>> And also the sprites were modelled and exported the same way .. as I
>> already wrote.
>>
>> So far, so good ;)
>> Thanks
>>
>>
>> Amir Taaki wrote:
>> > Hello,
>> >
>> > How exactly are you trying to move the sprite objects? Using Crystal
>> > Space C++ code or through 3DS Max?
>> >
>> >
>> > On 1/31/07, *Thomas Teufel* <[EMAIL PROTECTED]
>> > <mailto:[EMAIL PROTECTED]>> wrote:
>> >
>> > Hello!
>> >
>> > I have some kind of moving issue at some of my 3d sprites.
>> > At various 3d sprites with each an individual shape some do
>> move and
>> > some don't.
>> >
>> > They all were exported the exact same way out of 3ds max.
>> > Also the loading command is the same.
>> > Loading works! .. no Errors or something like that are displayed.
>> > I can even see all of them with texture.
>> >
>> > I move those sprites with a collider actor.
>> >
>> > Is there something special one has to watch out at modeling a
>> sprite?
>> > (There for example is one that is just a very simply shaped
>> > cylinder and
>> > it does not move.)
>> >
>> > Or does anyone of you knows where the issue might be?
>> >
>> >
>> > Thanks a lot!
>> > Thomas
>> >
>> >
>> >
>> >
>> >
>> >
>> -------------------------------------------------------------------------
>>
>> > Take Surveys. Earn Cash. Influence the Future of IT
>> > Join SourceForge.net's Techsay panel and you'll get the chance to
>> > share your
>> > opinions on IT & business topics through brief surveys - and
>> earn cash
>> >
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>
>> >
>> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
>>
>> > _______________________________________________
>> > Crystal-main mailing list
>> > [email protected]
>> > <mailto:[email protected]>
>> > https://lists.sourceforge.net/lists/listinfo/crystal-main
>> > Unsubscribe: mailto: [EMAIL PROTECTED]
>> >
>> <mailto:[EMAIL PROTECTED]>?subject=unsubscribe
>> >
>> >
>>
>>
>> -------------------------------------------------------------------------
>>
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to
>> share your
>> opinions on IT & business topics through brief surveys - and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>
>> _______________________________________________
>> Crystal-main mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/crystal-main
>> Unsubscribe:
>> mailto:[EMAIL PROTECTED]
>>
>
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]