Polaris 1 Posted September 17, 2013 (edited) _pos = OffRoad worldToModel (getPos OffRoad); [0.000976563,0.015625,-1.54855] I was under the impression that this should be returning [0,0,0]? I've been trying to use this for a reasonably complex attachTo setup and if you try to use it the X and Y location is correct but it ends up being about 1-2m in the ground. This seems to explain why, obviously the X and Y are basically 0 so you can't notice the error but the -1.5 is really affecting the position. I've tried basically all of the different types of getPos as well and that hasn't helped. I've tried different parts of the map as well and there's always a -1-2m error in the Z coord. The vehicle being tested is perfectly level on the ground as well and is a stock BIS vehicle (the offroad to be specific). Anyone have any ideas or is this one for the tracker? Edit: The more and more I experiment the Z value simply seems wrong and it's making it extremely difficult to use attachTo accurately. The X and Y cords work perfectly but not the Z. I've tried to abs the value thinking it was just a minus sign error but it's still wrong. If I use the Z value that is generated here in the attachTo the vehicle is either in the ground or the air when it should be perfect. Edited September 17, 2013 by Polaris Share this post Link to post Share on other sites
sakura_chan 9 Posted September 17, 2013 getpos returns the vehicle's centerpoint above ground level. In this case the vehicle's centerpoint is 1.5m above the ground. When used in worldtoModel, it places the position -1.5m down relative to the model. Not quite sure what you are after, if you want it to return [0,0,0] then you could just use _pos = [0,0,0] Share this post Link to post Share on other sites
Polaris 1 Posted September 17, 2013 (edited) The returned 3D position is an offset. If you attempt to find the offset using the same vehicle then it should return [0,0,0], the Z offset shouldn't be -1.5. It should essentially be looking for the offset from it's center to it's center and therefore should return all zeros. _pos = OffRoad worldToModel (getPos OffRoad1); OffRoad1 attachTo [OffRoad,_pos]; The car that's just been attached is almost entirely in the floor. Edited September 17, 2013 by Polaris Share this post Link to post Share on other sites
sakura_chan 9 Posted September 17, 2013 Hmm there seems to be a difference between getpos and modelpos. Getpos will actually return a height of zero when the vehicle is on the ground! Well, it is easy enough to fix, you just use the modeltoworld to find the difference between the modelpos and the getpos. _attachObj = Offroad1; _BaseObj = offroad; _attachpos = (getpos _attachObj); _attachZ = (_attachObj worldtomodel _attachpos) select 2; // finds the height difference between the modelpos and the getpos returns _attachRelPos = _BaseObj WorldToModel [_attachpos select 0, _attachpos select 1, (_attachpos select 2) - _attachZ]; _attachObj attachto [_BaseObj, _attachRelPos]; This script was putting the vehicle perfectly into position above the ground Share this post Link to post Share on other sites