- Home /
Projectile over network problem
var instantiatedProjectile : Rigidbody = Network.Instantiate(projectile, transform.position, transform.rotation, 0);
instantiatedProjectile.velocity = transform.TransformDirection(Vector3(0, 0, speed));
Physics.IgnoreCollision(instantiatedProjectile.collider, transform.root.collider);
I want to instantiate a projectile over the network. It works, but only in one side. For example, client does shooting, it works normally in client. But in server side, the bullets are moving very very slow and the directions are weird.
So, the question is how to synchronize it?
Anyone can help? Thanks :)
Use SmartFox server, it'd save you a lot of trouble. Personal opinion though, can't help directly.
I think the problem is in the script, not technology. The game uses LAN connection by the way. But thanks for responding. Anyone can help?
I have the same problem. $$anonymous$$untahu, please, did you solved this problem?.
Thank you.
I've got a jitered trajectory for all my instanced projectiles over my network. I don't know what to do...Any tutorial where this is solved for a $$anonymous$$aster-Server connection?.
Thank you in advance.
@jorgon: The question is one and a half years old. The last time the op was on is also a year ago. I don't think hs would answer your "comment".
Anyway, like @Techsuport-1 said the problem is propably that those additional actions (setting a movement speed and setting ignore collision) are only done on the pc of the projectiles owner (the guy that shoots it).
You don't need to use RPCs for such an task. As long as they doesn't need further dynamic information the projectile should have a script attached that does those self-initializations.
So on a script on the projectile prefab do some thing like that:
var speed = 5.5
function Start()
{
rigidbody.velocity = transform.TransformDirection(Vector3(0, 0, speed));
Physics.IgnoreCollision(collider, transform.root.collider);
}
Of course the projectile needs it's own speed variable. If you want different speeds you have to use RPCs. Alwasy ask yourself what information does the other side have about an object. Everything that's missing but needed has to be send over in some way.
Answer by Techsuport 1 · Mar 15, 2011 at 02:51 AM
u will have to do the velocity and collision in an RPC call i think, cause that will only set that stuff localy.