- Home /
Multiplayer
How to deal with physics combined with an RPC because right now I am making an multiplayer FPS and everything working nice like movements, damages etc. Only physics on the bullets when I shoot they float instead of falling on the ground.
Any idea how to fix it?
Piece of code:
[RPC]
void BulletSpawn (Vector3 position, Quaternion rotation, Vector3 force)
{
randomSpread = Instantiate(Hulzen, position, rotation) as Rigidbody;
randomSpread.AddForceAtPosition(force, position, ForceMode.Impulse);
}
networkView.RPC("BulletSpawn", RPCMode.All, spawnPointHulzen.position, spawnPointHulzen.rotation, new Vector3(Random.Range(6,6), Random.Range(1,1.5f), Random.Range(3,3)) * 0.7f);
Thanks in advance!
Did you already try to attach NetworkViews to the Bullets and bulletHoles and then Instantiate them using Network.Instantiate(....) ?
Hi, I fixed it haha but now I have another issue how to handle RPC with physics (RIGIDBODY). When I shoot bullets they fly in the air, they fall on the ground on my screen but at the second player they are floating in the air.
Yes all of them. Everything works now properly, only the problem now is how to deal RPC with physics (RIGIDBODY).
Can u write an example code or something?
[RPC] void BulletSpawn (Vector3 position, Quaternion rotation, Vector3 force) { randomSpread = Instantiate(Hulzen, position, rotation) as Rigidbody; randomSpread.AddForceAtPosition(force, position, Force$$anonymous$$ode.Impulse); }
Piece of code, the spawn part works fine only the physics won't.