Crystal Space
Welcome, Guest. Please login or register.
September 03, 2014, 12:25:11 am

Login with username, password and session length
Search:     Advanced search
9009 Posts in 2043 Topics by 8379 Members
Latest Member: Hamlock3
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  General Crystal Space Discussion
| | |-+  Characters and moving them around the level.
« previous next »
Pages: [1] Print
Author Topic: Characters and moving them around the level.  (Read 1987 times)
FCP
Guest


Email
« on: March 18, 2006, 03:22:48 pm »

At this stage I am beginning to look at how to load a character model from code and make it chase the player around the level a bit Smiley - are there any examples in the documentaion/tutorial/anywhere else that I can look at?
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: March 19, 2006, 09:49:47 am »

At this stage I am beginning to look at how to load a character model from code and make it chase the player around the level a bit Smiley - are there any examples in the documentaion/tutorial/anywhere else that I can look at?

Not really but if you use CEL you can already get a bit further in this. Are you using CEL right now?

Greetings,
Logged
FCP
Guest


Email
« Reply #2 on: March 19, 2006, 03:56:55 pm »

Yes, yes I am. Cel is pretty handy actually.
Logged
FCP
Guest


Email
« Reply #3 on: March 19, 2006, 05:56:47 pm »

Can you or anyone give me a tip or an example code of loading an npc using the CEL's api though?

Or is it even possible at this stage, with pcnpcmove beahivioral layer and iPcNpcMove structs not being fully implemented?

This is what I have for loading an NPC code (that crashes the program when called):

csPtr<iCelEntity> CelTest::CreateNPCActor (const char* name,
   const char* /*factname*/, const csVector3& /*pos*/)

{
 csRef<iCelEntity> NPCentity_cam = pl->CreateEntity (name, bltest,
        "actor",
   "pcactormove",
   "pcmesh",
   "pcmeshselect",
   "pclinearmovement",
   "pctooltip",
   "pcinventory",
   "pcsoundlistener",
  if (!entity_cam) return 0;

  // Get the iPcActorMove interface so that we can set movement speed.
  csRef<iPcActorMove> pcactormove = CEL_QUERY_PROPCLASS_ENT (NULL,
     iPcActorMove);
  pcactormove->SetMovementSpeed (2.0f);
  pcactormove->SetRunningSpeed (5.0f);
  pcactormove->SetRotationSpeed (1.75f);
  pcactormove->SetJumpingVelocity (6.31f);

  csRef<iPcMesh> evilpcmesh = CEL_QUERY_PROPCLASS_ENT (NPCentity_cam, iPcMesh);
  bool evilhascal3d = true;
  evilpcmesh->SetPath ("/cel/data/");
  evilhascal3d = evilpcmesh->SetMesh ("test", "cally.cal3d");

//calls to iPcNpcMove struct
  csRef<iPcNpcMove> npclinmove = CEL_QUERY_PROPCLASS_ENT (NPCentity_cam,
   iPcNpcMove);

  return csPtr<iCelEntity> (NPCentity_cam);
}


And the call in CreateRoom():

  entity_dummy1 = CreateNPCActor ("NPC", "", csVector3 (0,0,10));
  if (!entity_dummy1) return false;

Any idea why that crashes?
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 3.362 seconds with 13 queries.