Jump to content

Attach parachute to player


2kristof2

Recommended Posts

  • Moderators

You can ! Wumbaloo you are kinda new to MTA, I don't want to be rude but if you are not sure, just don't say it. (It sounds rude I know, but i don't know how to better write it)

You need to use matrix calculations. But it requires some advanced math calculations.

I don't know the logics and calculations myself but I can tell you that you have to use that along with the bones positions of the player model:

getPedBonePosition

You can try to do it yourself (for the sake of learning) but @CrystalMV made a resource that provides you new functions that does the maths for you:

Bone attachments:

Website: http://crystalmv.net84.net/pages/script ... attach.php

Documentation: http://crystalmv.net84.net/pages/script ... attach.php

Video:

MTA Community page: https://community.multitheftauto.com/index.php?p= ... ls&id=2540

You should be able to attach your parachute properly with that.

Best regards,

Citizen

Link to comment

Thanks :)

I tried to use getPedBonePosition yesterday but without any result. :c

I also checked CrystalMV's script and it seems to be very interesting but also complicated for me. I copied functions from attach_func.lua and added few lines to my parachute script:

local Me = getLocalPlayer() 
local x,y,z = getElementPosition( Me ) 
local rx,ry,rz = getElementRotation( Me ) 
parachute = createObject(371, x,y,z, rx, ry, rz) 
exports.bone_attach:attachElementToBone(parachute,Me, 3, 0, 0.25, 0.17,-90,2,0) 

It doesn't work for me but I'm going to try it once again.

I would be so glad to see any advice what should I do or use ;)

Link to comment
  • Moderators

It works just fine for me (just need some adjustments though):

2a4177ba805542cd5b27cb97631051a7.png

You need to:

1 - Download the bone_attach.zip and place it in your resources folder

2 - Start the bone_attach resource or you won't be able to use the exported functions.

3 - Use the code you just pasted in the previous post.

You can add an tag in your meta to start the bone_attach resource automatically with your resource.

Link to comment

It worked when I changed bone id but only when I use bone_attach resource, how to make it only for 1 map client-sided?

Edit: I think I solved the problem :D If I find new issues I'll bump this topic. Thanks Citizen ;)

PS if someone have an idea which bone would be the best to attach a parachute please write. :P

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...