Crystal Space
Welcome, Guest. Please login or register.
November 20, 2014, 10:31:08 pm

Login with username, password and session length
Search:     Advanced search
9018 Posts in 2046 Topics by 9076 Members
Latest Member: Aneurm
* Home Help Search Login Register
+  Crystal Space
|-+  Associate Projects
| |-+  CEL Discussion
| | |-+  How to set my actor's position when I enter the game?
« previous next »
Pages: [1] Print
Author Topic: How to set my actor's position when I enter the game?  (Read 4348 times)
Hilake
Newbie
*
Posts: 27


View Profile Email
« on: July 23, 2005, 08:50:24 am »

Hi, all!
I'm new guy for CEL.

I have learned celtest several days. Now I want to set the actor's position ,because it always appear on the same place:) .If there are some method to change the position and orientation?

I use the "pclinmove->SetPosition(pos,yrot,sector);" to set the entity's position.
But it only changed the yrot, while the entity's position did not change. How can I do?

Any comment will be welcome!

thanks
Hilake

Any comment will be welcome!

thanks
Hilake
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: July 23, 2005, 10:30:06 am »

Hi, all!
I'm new guy for CEL.

I have learned celtest several days. Now I want to set the actor's position ,because it always appear on the same place:) .If there are some method to change the position and orientation?

I use the "pclinmove->SetPosition(pos,yrot,sector);" to set the entity's position.
But it only changed the yrot, while the entity's position did not change. How can I do?

Any comment will be welcome!

thanks
Hilake

Any comment will be welcome!

thanks
Hilake

That's strange. SetPosition() should work. Can I see the full code you're using?
I just checked the code of SetPosition() and it looks correct.

Greetings,
Logged
Hilake
Newbie
*
Posts: 27


View Profile Email
« Reply #2 on: July 25, 2005, 05:34:48 am »

Hi!

I just add one sentence in the celtest:

csRef<iPcLinearMovement> pclinmove = CEL_QUERY_PROPCLASS_ENT (entity_cam,
    iPcLinearMovement);
  if (hascal3d)
  {
    pclinmove->InitCD (
      csVector3 (0.5f, 0.8f,  0.5f),
      csVector3 (0.5f, 0.4f,  0.5f),
      csVector3 (0.0f, 0.01f, 0.0f));
  }
  else
  {
    pclinmove->InitCD (
      csVector3 (0.5f,  0.8f, 0.5f),
      csVector3 (0.5f,  0.4f, 0.5f),
      csVector3 (0.0f, -0.4f, 0.0f));
  }

 pclinmove->SetPosition(pos,yrot,sector); ///add

So! Is there any problems?


That's strange. SetPosition() should work. Can I see the full code you're using?
I just checked the code of SetPosition() and it looks correct.

Greetings,
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #3 on: July 25, 2005, 05:38:14 am »

Hi!

I just add one sentence in the celtest:

csRef<iPcLinearMovement> pclinmove = CEL_QUERY_PROPCLASS_ENT (entity_cam,
    iPcLinearMovement);
  if (hascal3d)
  {
    pclinmove->InitCD (
      csVector3 (0.5f, 0.8f,  0.5f),
      csVector3 (0.5f, 0.4f,  0.5f),
      csVector3 (0.0f, 0.01f, 0.0f));
  }
  else
  {
    pclinmove->InitCD (
      csVector3 (0.5f,  0.8f, 0.5f),
      csVector3 (0.5f,  0.4f, 0.5f),
      csVector3 (0.0f, -0.4f, 0.0f));
  }

 pclinmove->SetPosition(pos,yrot,sector); ///add

So! Is there any problems?

Ah ok. That's why it doesn't work. You change the position here but later in celtest the position will be changed again. i.e. In the CreateRoom() routine the position will be set by the zonemanager after calling CreateActor().

Greetings,
Logged
Hilake
Newbie
*
Posts: 27


View Profile Email
« Reply #4 on: July 25, 2005, 06:51:56 am »

Thanks !

Is it set again by this function?:

virtual int iPcZoneManager::PointMesh  (  const char *  entity, 
  const char *  regionname, 
  const char *  startname = 0
 )  [pure virtual]

but in this way, what is the meaning  of the 'startname'? I didn't know why it set the position?
And, when I want to set the actor position how can I do?

Any suggest??


Ah ok. That's why it doesn't work. You change the position here but later in celtest the position will be changed again. i.e. In the CreateRoom() routine the position will be set by the zonemanager after calling CreateActor().

Greetings,
« Last Edit: July 28, 2005, 10:54:54 am by Hilake » Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #5 on: July 30, 2005, 07:31:14 pm »

Thanks !

Is it set again by this function?:

virtual int iPcZoneManager::PointMesh  (  const char *  entity, 
  const char *  regionname, 
  const char *  startname = 0
 )  [pure virtual]

but in this way, what is the meaning  of the 'startname'? I didn't know why it set the position?
And, when I want to set the actor position how can I do?

Any suggest??


'startname' is the name of the starting position that you can define in your map file. You can set the actor position with your code but you just have to do it at another time. i.e. after that PointMesh().

Greetings,
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 5.364 seconds with 16 queries.