Therein lies the problem… Quadrupeds, dogs, sheep, cows, goats, etc., have 4 legs… duh. This means that when it comes to positioning them on a side of a hill, simple vectorUp of [0,0,1] (like it is done for bipeds) just won’t do. If the animal is walking towards the top or the bottom of the hill, this could result in the animal being half inserted into the ground, as you can see on the following video:

For this kind to work, you need vectorUp of the animal to align with surfaceNormal of the ground under its feet, which will make animal align with the hill side. However, when the animal is walking along the side of the hill, vectorUp of [0,0,1] is exactly what is needed. So depending on the orientation of the animal on the side of the hill, the vectorUp of the animal should vary between [0,0,1] and surfaceNormal. Easy said than done?

Thanks to the multitude of recently added vector commands, it is quite easy, really. I’ve made a little test code for you to play with. Hopefully someone from Bohemia will take a look at it and make this or similar solution as default method for all quadrupeds orientation in Arma 3, to stop ruining the immersion in this great game (although my previous attempt to set snakes right didn’t go anywhere far).

sheep = []; for "_i" from 1 to 10 do { _sheep = createAgent ["Sheep_random_F", position player, [], 0, "NONE"]; _sheep setDir random 360; sheep pushBack _sheep; }; addMissionEventHandler ["Draw3D", { { _vSide = vectorDirVisual _x vectorCrossProduct [0,0,1]; _vUp = surfaceNormal getPosVisual _x; _vDir = _vUp vectorCrossProduct _vSide; _x setVectorDirAndUp [_vDir, [0,0,1]]; } forEach sheep; }];

Oh, you need to be on DEV branch to try this right now (or 1.27+ version of main branch), because of brand new commands used.


EDIT: Updated algorithm to faster and more precise.