Crystal Space
Welcome, Guest. Please login or register.
July 24, 2014, 07:08:42 pm

Login with username, password and session length
Search:     Advanced search
9005 Posts in 2043 Topics by 8229 Members
Latest Member: Kula999lidia
* Home Help Search Login Register
+  Crystal Space
|-+  Associate Projects
| |-+  CEL Discussion
| | |-+  How to switch camera & input between multiple actors?
« previous next »
Pages: [1] Print
Author Topic: How to switch camera & input between multiple actors?  (Read 3434 times)
rvhaasen
Jr. Member
**
Posts: 62


View Profile
« on: January 11, 2008, 11:38:01 am »

Hi,

i use several actors in a networked multi-user application, the actors are defined as follows:
Code:
  _entity = pl->CreateEntity ("player", bl, "player_behave",
    "pcdefaultcamera",
    "pcmesh",
    "pclinearmovement",
    "pcactormove",
    "pccommandinput",
    "pcinventory",
    CEL_PROPCLASS_END);
One of these actors is controlled locally, the other ones are controled remote by other players in the network.
I don't know how to couple the camera and input to 1 particular actor in the scene.

For the input part i can check in the SendMessage method of the "PlayerBehavior class" to only update the actor position if the actor is "active". Not very elegant but it should work. A nicer solution would be to disable the "pccommandinput" propertyclass so that no kb-events will be sent to this entity. Can this be done?

The camera is something that is now only controlled by the cel-part, i can switch between the several camera modes,using the "m" keybinding of the pcdefaultcamera propertyclass, i didn't have to code anything for this  (which is great). I don't know however how to connect my view to 1 particular camera (belonging 1 particular actor).

Does somebody knows how to do this?
Thanks
Logged
Vincent
Full Member
***
Posts: 191


View Profile WWW
« Reply #1 on: February 23, 2008, 09:45:41 pm »

For the input part i can check in the SendMessage method of the "PlayerBehavior class" to only update the actor position if the actor is "active". Not very elegant but it should work. A nicer solution would be to disable the "pccommandinput" propertyclass so that no kb-events will be sent to this entity. Can this be done?

  iPcCommandInput::Activate(false) should do what you want.

The camera is something that is now only controlled by the cel-part, i can switch between the several camera modes,using the "m" keybinding of the pcdefaultcamera propertyclass, i didn't have to code anything for this  (which is great). I don't know however how to connect my view to 1 particular camera (belonging 1 particular actor).

   mmm. Interesting question.
I think one way could be to have only one pccamera attached to a "central" or "manager" entity (whatever, not one per player entity),
and use iPcDefaultCamera::SetFollowEntity(iCelEntity *entity). Assuming you use default camera...
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.15 seconds with 16 queries.