{"name":"isTouchingGround","operator":null,"title":"isTouchingGround","type":"command","url":"https://community.bistudio.com/wiki/isTouchingGround","revid":376406,"updated":"2025-10-11T00:58:13Z","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":"global","effect":null,"server_exec":false},"exec":null,"description":"Returns true if object is touching the ground.","syntaxes":[{"syntax":"isTouchingGround object","since":null,"effect":null,"exec":null,"params":[{"name":"object","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"object: Object"}],"returns":{"type":"Boolean","types":["Boolean"],"description":null,"text":"Boolean"},"form":"unary","operator":null,"left":null,"right":{"text":"object","types":["Object"]}}],"examples":[{"text":"```sqf\nif (isTouchingGround player) then { hint \"Terraferma!\" };\n```","code":["if (isTouchingGround player) then { hint \"Terraferma!\" };"]},{"text":"A full \"is safely parked\" method for air, ground and water vehicles:\n\n```sqf\n// get if a vehicle is properly parked - covers e.g helicopter landed on a building, boat (beached or not) and underwater or not submarine\n// return false on null, disabled or destroyed vehicle\nprivate _isSafelyParked = {\n    params [\n        [\"_vehicle\", objNull, [objNull]],                // 0: OBJECT - vehicle - a null object returns false\n        [\"_altitudeTolerance\", 0.1, [0]],                // 1: NUMBER - altitude tolerance - in metre\n        [\"_velocityTolerance\", 0.01, [0]]                // 2: NUMBER - velocity tolerance - in km/h\n    ];\n\n    if (not canMove _vehicle) exitWith { false };        // returns false for null as well\n\n    if (_vehicle isKindOf \"Ship\") then\n    {\n        // surfaceIsWater getPosASL _vehicle                        // a beached boat is fine\n        velocity _vehicle params [\"_velX\", \"_velY\"];\n        sqrt (_velX * _velX + _velY * _velY) < _velocityTolerance    // only 2D speed matters (think waves)\n        && {\n            getPosASLW _vehicle select 2 < _altitudeTolerance                // underwater submarines are OK\n            || { getPos _vehicle select 2 < _altitudeTolerance }    // beached boat\n        };\n    }\n    else\n    {\n        // over -a- ground and not over ocean\n        (isTouchingGround _vehicle || {\n            getPosASLW _vehicle select 2 >= _altitudeTolerance        // not in water\n            && { getPos _vehicle select 2 < _altitudeTolerance }\n        })\n        && { vectorMagnitude velocity _vehicle * 3.6 < _velocityTolerance }\n    }\n};\n\nobjectParent player call _isSafelyParked;\n```","code":["// get if a vehicle is properly parked - covers e.g helicopter landed on a building, boat (beached or not) and underwater or not submarine\n// return false on null, disabled or destroyed vehicle\nprivate _isSafelyParked = {\n\tparams [\n\t\t[\"_vehicle\", objNull, [objNull]],\t\t\t\t// 0: OBJECT - vehicle - a null object returns false\n\t\t[\"_altitudeTolerance\", 0.1, [0]],\t\t\t\t// 1: NUMBER - altitude tolerance - in metre\n\t\t[\"_velocityTolerance\", 0.01, [0]]\t\t\t\t// 2: NUMBER - velocity tolerance - in km/h\n\t];\n\n\tif (not canMove _vehicle) exitWith { false };\t\t// returns false for null as well\n\n\tif (_vehicle isKindOf \"Ship\") then\n\t{\n\t\t// surfaceIsWater getPosASL _vehicle\t\t\t\t\t\t// a beached boat is fine\n\t\tvelocity _vehicle params [\"_velX\", \"_velY\"];\n\t\tsqrt (_velX * _velX + _velY * _velY) < _velocityTolerance\t// only 2D speed matters (think waves)\n\t\t&& {\n\t\t\tgetPosASLW _vehicle select 2 < _altitudeTolerance\t\t\t\t// underwater submarines are OK\n\t\t\t|| { getPos _vehicle select 2 < _altitudeTolerance }\t// beached boat\n\t\t};\n\t}\n\telse\n\t{\n\t\t// over -a- ground and not over ocean\n\t\t(isTouchingGround _vehicle || {\n\t\t\tgetPosASLW _vehicle select 2 >= _altitudeTolerance\t\t// not in water\n\t\t\t&& { getPos _vehicle select 2 < _altitudeTolerance }\n\t\t})\n\t\t&& { vectorMagnitude velocity _vehicle * 3.6 < _velocityTolerance }\n\t}\n};\n\nobjectParent player call _isSafelyParked;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["underwater"],"notes":[{"user":"AgentRev","date":"2014-06-01T01:23:00Z","text":"If you are using this command as a validation method, it should not be the sole thing you are checking for, as the result is often inaccurate.\nFor example, it returns false for some helicopters when landed on the roof of certain buildings, and it always returns false for boats, even if they are beached."},{"user":"Demellion","date":"2016-09-29T08:28:00Z","text":"In addition to previous statement: That behaviour is true, simply because isTouchingGround applied to a player unit (or any unit) is frozen to a last state when unit enters vehicle.\nTo get proper return from this command you should go for units vehicle:\n\n```sqf\n_var = isTouchingGround player;                // unreliable\n_var = isTouchingGround (vehicle player);    // pretty reliable\n```"},{"user":"Pierre MGI","date":"2016-11-10T20:57:00Z","text":"This command returns always true if the falling object is attached to some other object with the attachTo command, like for vehicle air drop with parachute."},{"user":"Gippo","date":"2017-04-26T20:02:00Z","text":"Be aware: it is not reliable on remote objects."}],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Object Manipulation","Introduced with Arma 3 version 0.50","Scripting Commands"]}