Unity with SFS problem

Post here all your questions related with SmartFoxServer .Net/Unity3D API

Moderators: Lapo, Bax

makelife
Posts: 4
Joined: 28 Sep 2009, 04:48

Unity with SFS problem

Postby makelife » 28 Sep 2009, 04:50

Hi!folks.
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
Thanks.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 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.

Best
Thomas
makelife
Posts: 4
Joined: 28 Sep 2009, 04:48

Postby makelife » 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);
Physics.IgnoreCollision(remoteBullet.collider, transform.root.collider);
I am so confused for it.
Please help me.Thomast :cry:

bob
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 30 Sep 2009, 05:39

Hi Bob

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.

file:///Applications/Unity/Unity.app/Contents/Documentation/Documentation/ScriptReference/Rigidbody.AddRelativeForce.html


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.

/Thomas
makelife
Posts: 4
Joined: 28 Sep 2009, 04:48

Postby makelife » 30 Sep 2009, 06:34

Hi!Thomas
Thanks for your reply.

But how to give trigger to the remoteplayer?

BOb

Return to “.Net / Unity3D API”

Who is online

Users browsing this forum: Google [Bot] and 1 guest