Page 1 of 1
Unity with SFS problem
Posted: 28 Sep 2009, 04:50
I have a problem.The remoteplayer insantiate a bullet,but the another player can't see the bullet.Who can tell me why?Please help me.How to do it
Posted: 28 Sep 2009, 12:29
We will need more information to be able to help you.
The island demo code only synchronizes player transform, animations and does chat. Did you extend the code to support the bullets?
If yes, then share the code please and say what kind of errors you get on e.g. the console.
Posted: 30 Sep 2009, 05:14
Yes!there is no error.
Rigidbody remoteBullet = (Rigidbody)Instantiate(Bullet,pos,rot);
this code can instantiate the bullet.
but the following code cann't move the bullet.
remoteBullet.velocity = transform.TransformDirection (Vector3.forward * BulletSpeed);
I am so confused for it.
Please help me.Thomast
Posted: 30 Sep 2009, 05:39
This doesnt really sound much like a SFS question, but rather a general Unity one.
Some quick questions - how do you transport the "shoot" message over the network? Similar to the animation, so you basically tells the client that the enemy has pulled the trigger?
Or do you try to run physics over the network where you send the coordinates, velocity etc. of every bullet and try to sync them?
If its the first - are you certain the message arrives on the client? If your primary problem then is moving the bullet initially, then you need to look into AddForce/AddRelativeForce rather than trying to manipulate the velocity directly.
If its the latter, then you are on your own. It is my experience that you should _not_ try to run physics over the net. Period.
Posted: 30 Sep 2009, 06:34
Thanks for your reply.
But how to give trigger to the remoteplayer?