Hyunsu Posted July 18, 2011 Posted July 18, 2011 sorry to my bad english. i want to be added "SetPlayerAttachedObject" function in mta. Already, this function exist in samp. this function attach object to player's bone. Then, the object's position and rotation are changed by the bone's movement. i will make this fuction in MTA. but i can't make anything about this function. Now, can MTA's script make this function? (natural, like SAMP)
DiSaMe Posted July 18, 2011 Posted July 18, 2011 It has been possible to script for a long time - even before it was added in SA-MP. You simply need to get joint positions using getPedBonePosition and set object position to the same every frame. If you want the object to have the same rotation which bone has, you also need to get position of 1 or 2 more bones and use trigonometry to calculate rotations.
Hyunsu Posted July 18, 2011 Author Posted July 18, 2011 local eLight = createObject(335,0.0, 0.0, 0.0, 0.0, 0.0, 0.0); setElementCollisionsEnabled(eLight, false); addEventHandler("onClientPreRender", getRootElement(), function() local x,y,z = getPedBonePosition(getLocalPlayer(), 22); local x2,y2,z2 = getPedBonePosition(getLocalPlayer(), 23); local x3,y3,z3 = getPedBonePosition(getLocalPlayer(), 26); setElementRotation(eLight, math.deg(math.atan2(z2 - z, math.sqrt((x2-x)*(x2-x) + (y2-y)*(y2-y)))), 0.0, math.deg(math.atan2(-(x2-x), y2-y)) + 40); setElementPosition(eLight, x3,y3,z3); end ); i made similar script. (holding knife) but it's not perfect like samp. if you know method, write script here. plz
DiSaMe Posted July 19, 2011 Posted July 19, 2011 No one has pushed me further than people requesting bone attachment functions. https://community.multitheftauto.com/index.php?p= ... ls&id=2540 . Video:
Hyunsu Posted July 22, 2011 Author Posted July 22, 2011 No one has pushed me further than people requesting bone attachment functions. https://community.multitheftauto.com/index.php?p= ... ls&id=2540 . Video: You are pretty. Someday, I'll give you money.
Buffalo Posted July 23, 2011 Posted July 23, 2011 You are pretty. Someday, I'll give you money. That made my day!
Recommended Posts