Crystal Space
Welcome,
Guest
. Please
login
or
register
.
May 25, 2013, 09:04:30 am
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
9224
Posts in
2230
Topics by
5389
Members
Latest Member:
Sandradhernandez
Crystal Space
Crystal Space Development
Support
"InitCD" action in "pcmove.linear" property class
« previous
next »
Pages:
[
1
]
Author
Topic: "InitCD" action in "pcmove.linear" property class (Read 3098 times)
Shamaz.mazum
Newbie
Posts: 10
"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.
Logged
Vincent
Full Member
Posts: 191
Re: "InitCD" action in "pcmove.linear" property class
«
Reply #1 on:
June 18, 2008, 08:49:58 am »
Hi,
Did you write it by hand, or exported it using b2cs ?
CEL example files have no
vector3
parameters, just
vector
. Try changing that.
Also, specifying
offset
parameter in InitCD action may help.
Logged
Shamaz.mazum
Newbie
Posts: 10
Re: "InitCD" action in "pcmove.linear" property class
«
Reply #2 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?
Logged
jorrit
Administrator
Hero Member
Posts: 1703
Re: "InitCD" action in "pcmove.linear" property class
«
Reply #3 on:
June 18, 2008, 11:54:32 am »
The entities in walktut don't have CD enabled on them.
As to the first question. Can you show us the C++ code that makes the InitCD work?
Greetings,
Logged
Shamaz.mazum
Newbie
Posts: 10
Re: "InitCD" action in "pcmove.linear" property class
«
Reply #4 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));
..........................
}
Logged
jorrit
Administrator
Hero Member
Posts: 1703
Re: "InitCD" action in "pcmove.linear" property class
«
Reply #5 on:
June 18, 2008, 02:18:29 pm »
Quote from: Shamaz.mazum 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
Yes really, there is nothing in what you pasted that made sure that OTHER entities can
collide with those entities. The InitCD() initializes collision detection only for the purpose of
testing CD with other entities. Not for testing CD with that entity.
Quote
> Can you show us the C++ code that makes the InitCD work?
Yes. I write that:
Can you show a bit more code? i.e. what other property classes and other actions you do.
Greetings,
Logged
Shamaz.mazum
Newbie
Posts: 10
Re: "InitCD" action in "pcmove.linear" property class
«
Reply #6 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));
}
«
Last Edit: June 18, 2008, 02:50:07 pm by Shamaz.mazum
»
Logged
Pages:
[
1
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Crystal Space Development
-----------------------------
=> General Crystal Space Discussion
=> Support
-----------------------------
Crystal Space Project Development
-----------------------------
=> Feature Requests
=> Plugins
=> Bug Reports
-----------------------------
Crystal Space Development
-----------------------------
=> Game Content Creation
-----------------------------
Miscellaneous
-----------------------------
=> Article/Tutorial Requests
=> Article/Tutorial Discussion
-----------------------------
Crystal Space Project Development
-----------------------------
=> Development Discussion
-----------------------------
Crystal Space Projects
-----------------------------
=> Project Discussion
=> WIP Projects
=> Finished Projects
-----------------------------
Associate Projects
-----------------------------
=> CEL Discussion
=> Crystal Core Discussion
=> CrystalBlend Discussion
-----------------------------
Crystal Space Project Development
-----------------------------
=> Google Summer of Code
-----------------------------
Associate Projects
-----------------------------
=> Apricot (Open Game)
=> Ares Project
Loading...