Don Camillo 10 Posted March 8, 2012 May sound stupid, but is there (i'm sure there is somewhere) a way to reliably translate a vector from WorldCoordinates Space [x,y,z] into a objectCoordinates Space beside worldToModel. (While the model may be rotatet in 3 Axes). So far i found out: worldToModel operates with the positionAGL wich may be useful in some (wich ever) manners, but not in my Case. I'm not interestet in the relative Position to the next LOD, i always need to know the relative Position to the Objects "Pivot". I've done a inverse transformation Matrix script wich does that for me, but i still can't belive that this should be the right way. Any Ideas to achive my Goal smarter ?:confused: The intention behind this is to "Paint" a ImpactPosition recorded on my reference, to a "Dummy Object" using the HitPart EventHandler (yes i know the MP issue). My current excursion into linear algebra resultet into this: Private ["_targetPos","_hit","_target", "_newDammage","_iPos","_dPos","_tPos"]; _hit = (_this select 0) select 0; _target = _hit select 0; _targetPos = getPosASL _target; _iPos = (_hit select 3); _dPos = getPosASL dummy; _tPos = getPosASL _target; Private ["_veh","_offset","_up","_dir","_uCd","_h00","_h01","_h02","_h03","_h10","_h11","_h12","_h13","_h20","_h21","_h22","_h23","_h30","_h31","_h32","_h33"]; _up = vectorUp _target; _dir = vectorDir _target; _uCd = [_up,_dir] call bis_fnc_crossProduct; _iPos set [3,1]; _dPos set [3,1]; _h00 = ( ((_dir select 0) * (_uCd select 2)/(_uCd select 0) - (_dir select 2))*(_uCd select 1)/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(_uCd select 0)) - (_uCd select 2)/(_uCd select 0))*(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*(_dir select 0)/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(_uCd select 0)) - (_up select 0)/(_uCd select 0))/(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_uCd select 2)*(_up select 0)/(_uCd select 0) + (_up select 2)) - (_dir select 0)*(_uCd select 1)/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(_uCd select 0)^2) + 1/(_uCd select 0); _h01 = -(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*(_dir select 0)/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(_uCd select 0)) - (_up select 0)/(_uCd select 0))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_uCd select 2)*(_up select 0)/(_uCd select 0) + (_up select 2))) + (_dir select 0)/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(_uCd select 0)); _h02 = (((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*(_dir select 0)/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(_uCd select 0)) - (_up select 0)/(_uCd select 0))/(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_uCd select 2)*(_up select 0)/(_uCd select 0) + (_up select 2)); _h03 = -(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*(_dir select 0)/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(_uCd select 0)) - (_up select 0)/(_uCd select 0))*(((_tPos select 0)*(_uCd select 1)/(_uCd select 0) - (_tPos select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_tPos select 0)*(_uCd select 2)/(_uCd select 0) + (_tPos select 2))/(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_uCd select 2)*(_up select 0)/(_uCd select 0) + (_up select 2)) + ((_tPos select 0)*(_uCd select 1)/(_uCd select 0) - (_tPos select 1))*(_dir select 0)/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(_uCd select 0)) - (_tPos select 0)/(_uCd select 0); _h10 = -(((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))*(_uCd select 1)/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(_uCd select 0)) - (_uCd select 2)/(_uCd select 0))*((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_uCd select 2)*(_up select 0)/(_uCd select 0) + (_up select 2))) + (_uCd select 1)/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(_uCd select 0)); _h11 = ((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))^2*(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_uCd select 2)*(_up select 0)/(_uCd select 0) + (_up select 2))) - 1/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)); _h12 = -((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_uCd select 2)*(_up select 0)/(_uCd select 0) + (_up select 2))); _h13 = ((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*(((_tPos select 0)*(_uCd select 1)/(_uCd select 0) - (_tPos select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_tPos select 0)*(_uCd select 2)/(_uCd select 0) + (_tPos select 2))/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_uCd select 2)*(_up select 0)/(_uCd select 0) + (_up select 2))) - ((_tPos select 0)*(_uCd select 1)/(_uCd select 0) - (_tPos select 1))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)); _h20 = (((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))*(_uCd select 1)/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(_uCd select 0)) - (_uCd select 2)/(_uCd select 0))/(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_uCd select 2)*(_up select 0)/(_uCd select 0) + (_up select 2)); _h21 = -((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/(((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1))*(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_uCd select 2)*(_up select 0)/(_uCd select 0) + (_up select 2))); _h22 = 1/(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_uCd select 2)*(_up select 0)/(_uCd select 0) + (_up select 2)); _h23= -(((_tPos select 0)*(_uCd select 1)/(_uCd select 0) - (_tPos select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_tPos select 0)*(_uCd select 2)/(_uCd select 0) + (_tPos select 2))/(((_uCd select 1)*(_up select 0)/(_uCd select 0) - (_up select 1))*((_dir select 0)*(_uCd select 2)/(_uCd select 0) - (_dir select 2))/((_dir select 0)*(_uCd select 1)/(_uCd select 0) - (_dir select 1)) - (_uCd select 2)*(_up select 0)/(_uCd select 0) + (_up select 2)); _h30 = 0; _h31 = 0; _h32 = 0; _h33 = 1; _offset = [ [[_h00,_h01,_h02,_h03], _iPos] call bis_fnc_dotProduct, 0 - ([[_h10,_h11,_h12,_h13], _iPos] call bis_fnc_dotProduct), 0 - ([[_h20,_h21,_h22,_h23], _iPos] call bis_fnc_dotProduct)]; _veh = "Sign_sphere10cm_EP1" createVehicle [0,0,0]; _veh setPosASL [(_dPos select 0)-(_offset select 0), ((_dPos select 1)-(_offset select 1))-0.2, ((_dPos select 2)-(_offset select 2))+0.2]; [ALL_BALLS, _veh] call BIS_fnc_arrayPush; /* Hint Format [ " %1 %2 %3 %4\n"+ " %5 %6 %7 %8\n"+ " %9 %10 %11 %12\n"+ " %13 %14 %15 %16\n"+ "---------------------------\n"+ "Offset:\n %17\n"+ "Calc:\n %18\n"+ "Impact:\n %19\n"+ "Object:\n %20\n", _h00,_h01,_h02,_h03, _h10,_h11,_h12,_h13, _h20,_h21,_h22,_h23, _h30,_h31,_h32,_h33, _offset, [(_tPos select 0)-(_offset select 0), (_tPos select 1)-(_offset select 1), (_tPos select 2)-(_offset select 2)], //_target modelToWorld _offset, _iPos, _tPos ]; */ Hell! isnt it? ^^ greez, fREAk Share this post Link to post Share on other sites