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.
Unity with SFS problem
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
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
bob
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
bob
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
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
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
Return to “.Net / Unity3D API”
Who is online
Users browsing this forum: No registered users and 30 guests