Show Posts
|
|
Pages: [1]
|
|
1
|
Crystal Space Development / Support / Re: "InitCD" action in "pcmove.linear" property class
|
on: June 18, 2008, 02:40:16 pm
|
|
> Yes. I write that: Shit! iPcLinearMovement::InitCD() didn`t work.
It works well on player (player entity can collide with other entities (their meshes loaded using <meshobj/>), except CrystalAlpha): player_entity = pl->CreateEntity ("player", bl, "player_behave", "pccamera.old", "pcobject.mesh", "pcmove.linear", "pcmove.actor.standard", "pcinput.standard", "pcsound.listener", "pctools.inventory", CEL_PROPCLASS_END); if (!player_entity) return ReportError ("Error creating player entity!");
........................
csRef<iPcZoneManager> pczonemgr = CEL_QUERY_PROPCLASS_ENT ( level_entity, iPcZoneManager);
// Get iPcCamera interface csRef<iPcCamera> pccamera = CEL_QUERY_PROPCLASS_ENT (player_entity, iPcCamera);
// Get the iPcMesh interface so we can create the right mesh // for our player.
csRef<iPcMesh> pcmesh = CEL_QUERY_PROPCLASS_ENT ( player_entity, iPcMesh); csBox3 team_box (csVector3 (0.7f, 1.5f, 0.5f)); pcmesh->CreateNullMesh ("team_mesh", team_box); if (!pcmesh->GetMesh ()) return ReportError ("Error loading model!");
scfString regionname, startname; pczonemgr->GetLastStartLocation (®ionname, &startname); // Put player into the world pccamera->SetZoneManager (pczonemgr, true, regionname, startname);
// Set mesh to start position if (pczonemgr->PointMesh ("player", regionname, "Spawn")) return ReportError ("Can't find region or start position in region!");
// Get iPcLinearMovement so we can setup the movement system. csRef<iPcLinearMovement> pclinmove = CEL_QUERY_PROPCLASS_ENT ( player_entity, iPcLinearMovement); pclinmove->InitCD ( csVector3 (0.8f,0.8f,0.5f), csVector3 (0.6f,0.7f,0.5f), csVector3 (0,0,0));
// Get the iPcActorMove interface so that we can set some parameters csRef<iPcActorMove> pcactormove = CEL_QUERY_PROPCLASS_ENT ( player_entity, iPcActorMove); ------------------------
But it`s not work on other entities (CrystalAlpha, for example): BehaviourItem::BehaviourItem (iCelEntity* entity, ProjectBL* bl, iCelPlLayer* pl) : BehaviourCommon (entity, bl, pl) { GetMeshSelect(); if (mesh_select) { mesh_select->SetMouseButtons("r"); csRef<iPcCamera> player_camera = CEL_QUERY_PROPCLASS_ENT ( pl->FindEntity("player"), iPcCamera); mesh_select->SetCamera(player_camera); mesh_select->SetMaxSelectionDistance (1.5f); } pcmeshsel_down_id = pl->FetchStringID ("pcmeshsel_down");
// Test lines csRef<iPcLinearMovement> linmov = CEL_QUERY_PROPCLASS_ENT (entity, iPcLinearMovement); if (linmov) linmov->InitCD (csVector3 (0.7f, 0.35f, 0.7f), csVector3 (0.7f, 0.35f, 0.7f), csVector3 (0.0f, 0.0f, 0.0f)); }
|
|
|
|
|
2
|
Crystal Space Development / Support / Re: "InitCD" action in "pcmove.linear" property class
|
on: June 18, 2008, 02:12:20 pm
|
|
> The entities in walktut don't have CD enabled on them. Realy? See $CEL/share/cel*/data/walktut_entities
<addon plugin="celentity" entityname="badone">
<propclass name="pcobject.mesh"> <action name="LoadMesh"> <par name="filename" string="monkey" /> <par name="factoryname" string="monkey" /> </action> </propclass>
<propclass name="pcobject.mesh.select" />
<propclass name="pctools.properties"> <property name="pos1" vector="9,2,8" /> <property name="pos2" vector="6,2,8" /> ....................................... <propclass name="pcmove.linear"> <action name="InitCD"> <par name="body" vector=".2,.2,.2" /> <par name="legs" vector=".2,.2,.2" /> <par name="offset" vector="0,-.3,0" /> </action> <action name="SetPosition"> <par name="position" vector="9,3,8" /> <par name="sector" string="Scene" /> <par name="yrot" float="0" /> </action> </propclass>
<behaviour name="badone_behave" />
</addon>
> Can you show us the C++ code that makes the InitCD work? Yes. I write that:
BehaviourItem::BehaviourItem (iCelEntity* entity, ProjectBL* bl, iCelPlLayer* pl) : BehaviourCommon (entity, bl, pl) { .......................... csRef<iPcLinearMovement> linmov = CEL_QUERY_PROPCLASS_ENT (entity, iPcLinearMovement); linmov->InitCD (csVector3(xb, yb, zb), csVector3(xl, yl, zl), csVector3(0, 0, 0)); .......................... }
|
|
|
|
|
3
|
Crystal Space Development / Support / Re: "InitCD" action in "pcmove.linear" property class
|
on: June 18, 2008, 10:18:18 am
|
|
Hi.
Yep, I write it by hand. But as I said before, walk tutorial doesn`t detect collides with entities too. Also I added "offset" to "InitCD" action and changed "vector3" to "vector" (it is the same) but nothing changes. I think, I have not any dependences, that is needed to do collision detection, but I don`t know what it can be. Is it possible to do collision detection with bullet?
|
|
|
|
|
4
|
Crystal Space Development / Support / "InitCD" action in "pcmove.linear" property class
|
on: June 17, 2008, 09:39:53 am
|
|
Hi there!
I have a problem with "InitCD" action in "pcmove.linear" property class.
I try to initialize collision detection via "InitCD" action but collision detection doesn`t work. My entity from xml file: <addon entityname="CrystalAlpha" plugin="cel.addons.celentity"> <propclass name="pcobject.mesh"> <action name="LoadMeshPath"> <par string="/mydata/worlds/planetcontrolcenter/factories" name="path"/> <par string="Crystal" name="filename"/> <par string="Crystal" name="factoryname"/> </action> </propclass> <propclass name="pcobject.mesh.select"/> <propclass name="pctools.properties"> <property name="ITEM" bool="yes"/> <!--<property name="NPC" bool="no"/>--> </propclass> <propclass name="pcmove.linear"> <action name="SetPosition"> <par string="Scene" name="sector"/> <par name="yrot" float="0"/> <par name="position" vector3="1,1,1"/> </action> <action name="InitCD"> <par name="body" vector3="0.7,0.35,0.7"/> <par name="legs" vector3="0.7,0.35,0.7"/> </action> </propclass> <behaviour name="item_behave"/> </addon> Result is properly loaded and properly located mesh but without collision detection. If I place mesh into the world with <meshobj/> from <sector/> section or invoke iPcLinearMovement::InitCD from c++ code collision detection works ok.
Another strange thing is that collision detection don`t work with entities from WALKTUT but collision detection works well with walls and floor. I build crystal space with ODE with OPCODE support, but without bullet. Is my problem in dependences? Or maybe I do something wrong in describing "pcmove.linear" property class? Why Walktut doen`t work? Please help me.
|
|
|
|
|
6
|
Crystal Space Development / General Crystal Space Discussion / Re: Help me! Problem with sound
|
on: May 30, 2008, 05:54:49 am
|
|
Unfortunately, I can`t provide buildable variant because it have size of 180MB and because of strange promblem with forum: I can`t upload anything. I think all I can to do, it is give you some pieces of code if you need.
NB:Last post I forgot say you that I set up sound listener properly: it always follows the player mesh.
|
|
|
|
|
7
|
Crystal Space Development / General Crystal Space Discussion / Help me! Problem with sound
|
on: May 29, 2008, 02:51:54 pm
|
|
I can`t play sounds in Crystal Space using CEL. First I attach all needed plugins. Second I load my sound wrapper.
CsRef<iLoader> loader; CsRef<iSndSysRenderer> sndrdr; CsRef<iSndSysManager> sndmgr; CsRef<iCelPlLayer> pl; CsRef <MyBehaviourLayer> bl; .... loader->LoadSoundWrapper ("background", "/mydata/music/tarck02.ogg");
Third, I create music playing entity:
pl->CreateEntity ("music_player", bl, "item", "pcsound.source", CEL_PROPCLASS_END); csRef<iPcSoundSource> bgsound_source = CEL_QUERY_PROPCLASS_ENT (pl->FindEntity ("music_player"), iPcSoundSource);
Fourth, play sound
bgsound_source->SetSoundName ("background"); bgsound_source->GetSoundSource()->SetVolume (1.0f); bgsound_source->GetSoundSource()->GetStream()->SetLoopState ( CS_SNDSYS_STREAM_LOOP); bgsound_source->GetSoundSource()->GetStream()->Unpause();
On string "bgsound_source->GetSoundSource()->SetVolume (1.0f);" my game crashes.
I can play sounds with iSysSndRenderer and iSysSndManager: csRef<iSndSysStream> stream = sndrdr->CreateStream ( sndmgr->FindSoundByName ("background")->GetData(), CS_SND3D_DISABLE); csRef<iSndSysSource> source = sndrdr->CreateSource (stream); source->SetVolume(1.0f); stream->Unpause(); All works perfect, but I want play sounds using CEL. What I am doing wrong? Please help me to learn how to create playable sound source using sound wrappers and CEL.
|
|
|
|
|
10
|
Associate Projects / CrystalBlend Discussion / Crystal2blender problem
|
on: April 07, 2008, 12:43:24 pm
|
|
I download crystal2blender and have some problems. When I want to export my mesh into crystal space format, i got "E: Make sure you set your CRYSTAL environment variable before loading blender" error.
I was trying to launch blender this way (I use Linux): > CRYSTAL=/opt/crystalspace (path to crystal space) > export CRYSTAL > blender
but i still get this message. What is wrong? Sorry for bad English
|
|
|
|
|
|