{"name":"disableCollisionWith","operator":null,"title":"disableCollisionWith","type":"command","url":"https://community.bistudio.com/wiki/disableCollisionWith","revid":370442,"updated":"2024-12-09T20:57:09Z","groups":["Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma3","name":"Arma 3","version":"0.50"},"arma3_since":"0.50","branch":null,"locality":{"argument":"local","effect":"global","server_exec":false},"exec":null,"description":"Disable collision between provided objects. The collision is always disabled for both objects in the arguments.\n\n> [!IMPORTANT]\n> - this command does not disable collision between PhysX objects\n> - this command has to be executed where objects are local, and as long as they do not change locality, the effect of this command will be global:\n>   - if the two objects are not local to the same computer, then it has to be executed on both computers to achieve the desired effect\n>   - if one or both objects change locality, the command needs to be executed again on the new owner's machine(s) to maintain the effect\n> - the feature works by having an object registering a reference to the other object; this command stores such reference on both objects - see #Example 3","syntaxes":[{"syntax":"vehicle1 disableCollisionWith vehicle2","since":null,"effect":null,"exec":null,"params":[{"name":"vehicle1","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"vehicle1: Object"},{"name":"vehicle2","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"vehicle2: Object"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"vehicle1","types":["Object"]},"right":{"text":"vehicle2","types":["Object"]}}],"examples":[{"text":"```sqf\nplayer disableCollisionWith myWall;\n```","code":["player disableCollisionWith myWall;"]},{"text":"```sqf\n[_veh1, _veh2] remoteExecCall [\"disableCollisionWith\", 0, _veh1];\n```","code":["[_veh1, _veh2] remoteExecCall [\"disableCollisionWith\", 0, _veh1];"]},{"text":"```sqf\n// this command stores a reference to the other object on both arguments:\n_obj1 disableCollisionWith _obj2;    // _obj1 has a reference to _obj2, disabling collision with it\n                                    // _obj2 has a reference to _obj1, disabling collision with it\n\n// only one reference is required to disable collision, allowing more than one disabled collision\n_obj1 disableCollisionWith _obj3;    // _obj1 has a reference to _obj3, disabling collision with it\n                                    // _obj2 has a reference to _obj1, disabling collision with it\n                                    // _obj3 has a reference to _obj1, disabling collision with it\n                                    // factually, _obj1 has collisions disabled with _obj2 and _obj3\n\n// note that _obj1 collision can be changed without using the command on it directly\n_obj2 disableCollisionWith _obj3;    // _obj1 has no more reference to _obj3 and can collide with it\n                                    // _obj2 has a reference to _obj3, disabling collision with it\n                                    // _obj3 has a reference to _obj2, disabling collision with it\n```","code":["// this command stores a reference to the other object on both arguments:\n_obj1 disableCollisionWith _obj2;\t// _obj1 has a reference to _obj2, disabling collision with it\n\t\t\t\t\t\t\t\t\t// _obj2 has a reference to _obj1, disabling collision with it\n\n// only one reference is required to disable collision, allowing more than one disabled collision\n_obj1 disableCollisionWith _obj3;\t// _obj1 has a reference to _obj3, disabling collision with it\n\t\t\t\t\t\t\t\t\t// _obj2 has a reference to _obj1, disabling collision with it\n\t\t\t\t\t\t\t\t\t// _obj3 has a reference to _obj1, disabling collision with it\n\t\t\t\t\t\t\t\t\t// factually, _obj1 has collisions disabled with _obj2 and _obj3\n\n// note that _obj1 collision can be changed without using the command on it directly\n_obj2 disableCollisionWith _obj3;\t// _obj1 has no more reference to _obj3 and can collide with it\n\t\t\t\t\t\t\t\t\t// _obj2 has a reference to _obj3, disabling collision with it\n\t\t\t\t\t\t\t\t\t// _obj3 has a reference to _obj2, disabling collision with it"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["collisionDisabledWith","enableCollisionWith","setPhysicsCollisionFlag"],"notes":[{"user":"Ranwer","date":"2015-04-04T12:03:00Z","text":"disableCollisionWith is basically a script that when you apply it to an object, and your unit can go through it like a ghost. However, if you wish the object to be solid again, you may wish to use enableCollisionWith.\n\nAn example for this is:\n\n```sqf\n// name of unit in editor such as player1\n// name of object in editor such as barrel1\nbarrel1 disableCollisionWith player1;\n\n// to make the barrel solid again, do this as vice versa if you know what you are doing!\nbarrel1 enableCollisionWith player1;\n```\n\nOn a side note: this can come in handy a lot if you want a unit to sit on the back of a car or on top of a container"},{"user":"bloodwyn1756","date":"2018-05-29T06:58:00Z","text":"This command does not disable the roadway LOD."}],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Object Manipulation","Introduced with Arma 3 version 0.50","Scripting Commands","Scripting Commands: Global Effect"]}