Sending object over RPC
Options
Drakce
✭
Hi there, Im working on a game, and i have a problem. To explain this better. Here's a picture .
How can I send message to other players with information. ,,That player spawned cube at position, with rotation", and then be able to spawn it on other client(so we can see it) with p1 informations( position, rotation)?
[code2=javascript]if(Input.GetMouseButtonDown(0) && photonView.isMine){
var instance : Rigidbody = Instantiate(bullet, bulletSpawnPosition.position, transform.rotation) as Rigidbody;
var fwd : Vector3 = bulletSpawnPosition.TransformDirection(Vector3.forward);
instance.AddForce(fwd * power);
Destroy(instance.gameObject, 25);[/code2]
For example: FPS game, where you can see other player throwing grenade.
How can I send message to other players with information. ,,That player spawned cube at position, with rotation", and then be able to spawn it on other client(so we can see it) with p1 informations( position, rotation)?
[code2=javascript]if(Input.GetMouseButtonDown(0) && photonView.isMine){
var instance : Rigidbody = Instantiate(bullet, bulletSpawnPosition.position, transform.rotation) as Rigidbody;
var fwd : Vector3 = bulletSpawnPosition.TransformDirection(Vector3.forward);
instance.AddForce(fwd * power);
Destroy(instance.gameObject, 25);[/code2]
For example: FPS game, where you can see other player throwing grenade.
0
Comments
-
You can send an RPC like "i was at pos X throwing a Y with target pos Z". You need 3 parameters in your RPC method (x,y and z here) and then have to call that.
Read how to use RPCs in the Marco Polo Tutorial:
http://doc.exitgames.com/photon-cloud/M ... o_Tutorial0