- Home /
Networking ignore collisions
I am making my first networked game. Before any other players connect and it is just me in the scene I can shoot rockets out of my rocket launcher just fine thanks to ignoring the collisions of the rocket launcher. However, after another player connects, my rockets sometimes blow up right after they launch, like the ignore collsions isn't working anymore. Is the ignore collision not being passed to the other clients some how and causing them to blowup right after they are instantiated?
Is there some other line of code that I need in a networked game to make sure all the other clients are aware that the rocket should ignore the collision with the player who shot the rocket?
Answer by mlkielb 1 · Jun 22, 2010 at 05:47 PM
couldn't get this to work. Just moved the transform of my target initiators way outside of the collision box.
Answer by StephanK · Jun 20, 2010 at 09:43 AM
Just guessing because you didn't post any code, but is it possible that you ignore the rocket launcher "by name"? If you spawn new launchers they will probably not have the exact same name.
Answer by mlkielb 1 · Jun 20, 2010 at 02:39 PM
randomNumberX = Random.Range(-strayFactor, strayFactor);
randomNumberY = Random.Range(-strayFactor, strayFactor);
randomNumberZ = Random.Range(-strayFactor, strayFactor);
Transform bulletprefab1;
bulletprefab1 = (Transform)Network.Instantiate(bullet,
Shot1.transform.position, Shot1.transform.rotation,0);
Physics.IgnoreCollision(bulletprefab1.collider,transform.collider);
bulletprefab1.gameObject.GetComponent<BulletNet>().setLastHitBy(localPlayerName);
bulletprefab1.transform.Rotate(randomNumberX, randomNumberY, randomNumberZ);
No I've been ignore by the transform of the launcher. All the other code is for random rotation and scoreboard purposes.