Jump to content

[REL] 'NEW' Bone Attach using 'onClientPedsProcessed' and useful function 'attachElementToBone'


Tekken

Recommended Posts

I think the min_version is wrong and if you attach the items in another resource using "exports", when you restart the resource where you create the objects the attachtobones resource give errors, for what I tested it works fine with multiple players.

Not starting resource attachtobones as <min_mta_version> section in the meta.xml contains invalid version strings

 

Edited by RekZ
Link to comment
  • Scripting Moderators
2 minutes ago, Tekken said:

Resource got updated!

My suggestion is to put it on GitHub, it will allow us to see changes you've introduced. And in addition suggest any code changes (e.g performance wise).

Link to comment

Great work

I've personnaly manually updated my bone_attach resource the exact day when the onClientPedsProcessed got realized. I've immediatly seen the difference. Now attached elements are totally synced with the ped movement because when you use onClientRender or  onClientPreRender you have a little delay beforce re-positionning the attached obj when the player moves very fast (like aiming).

Edited by Gordon_G
  • Like 1
Link to comment

Update v1.4

-Added all bone_attach exported functions;
-Added all functions to client side;
-Even more optimization;

 

Available functions:

attachElementToBone(element, ped, bone, offx, offy, offz, offrx, offry, offrz)

detachElementFromBone(element)

isElementAttachedToBone(element)

getElementBoneAttachmentDetails(element)

  • returns a table with {ped, bone, offx, offy, offz, rotationMatrix};

setElementBonePositionOffset(element, offsetx, offsety, offsetz)

setElementBoneRotationOffset(element, offsetrx, offsetry, offsetrz)

Note: all functions are available client side! They're not synched with all clients!

 

DOWNLOAD

 

Cheers!

 

Link to comment

First of all, nice job, really appreciated :)

I have a question, why is not compatible with the old offsets? Is there any feasible workaround to work with them? I'm really interested in improving the performance of the bone_attach resource, since in my server is probably one of the most resource consuming script for the users, but, reworking all the offsets would be hours and hours of work.

Thanks!

Link to comment

Thank you, well while I have tested and it does worth the work as you will get about 50 to 60% better performance even more maybe, the offsets are not compatible as this resource calculates position by bone matrix and the bone_attach resource had some custom functions made for this. There might be a workaround but I’m a little nul when it comes to maths so I can’t say how, that’s why we have put up a github page, is someone known how they’re free to contribute. 

Link to comment
  • Moderators
7 hours ago, Tekken said:

Will do with all 3 of them just to see the differences. As Patrick did some days ago.

I uploaded a new version of pAttach (1.1), please use that version if you do it. I ran all tests again with the latest versions of resources, you can find new results in my thread.
And there is a typo in your resource (version 1.4), m_rad is not defined. I defined it for myself to run the tests.

Link to comment
18 hours ago, Patrick said:

I uploaded a new version of pAttach (1.1), please use that version if you do it. I ran all tests again with the latest versions of resources, you can find new results in my thread.
And there is a typo in your resource (version 1.4), m_rad is not defined. I defined it for myself to run the tests.

Well I run the tests and I get about the same results as yours so @Dutchman101 you have the results! Also may I or not discontinue this resource? as pAttach gives better performance? I personally don't like OOP so I may try to rework the table structure as this is I think the most harmful part performance wise.

 

Thank you.

Link to comment
  • MTA Anti-Cheat Team
On 23/01/2021 at 19:07, Tekken said:

Also may I or not discontinue this resource? as pAttach gives better performance

That's up to you.. i would advise you just add a line about it to your OP, and preserve this resource. Maybe someone (for any technical or bug reason) has no choice but to use an alternative to pAttach in the future, and maybe you can still come closer to (or even surpass) its level of performance by updates with tweaks to attachToBones in the future. So for the latter, you might not even want to discontinue development.

  • Like 1
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...