Jump to content

[vb.net] Attached Objects to Peds 'floating' Around Bone


Recommended Posts

Hey All. I am attaching a backpack to any pedestrian skin i chose. The problem is once its fixed onto the ped's bone it 'floats'. If you run the bag lags behind, and if you stand still the bag doesn't move while you character sways back and forth at idle. Here's the code:

Public Sub AddProp_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyDown        If e.KeyCode <> Keys.U Then Return        Dim bone As Integer = GTA.Native.Function.Call(Of Integer)(Hash.GET_HASH_KEY, "SKEL_Neck_1")        Dim bags As Entity = World.CreateProp("prop_michael_backpack", Game.Player.Character.Position, True, False)        GTA.Native.Function.Call(Hash.ATTACH_ENTITY_TO_ENTITY, bags, Game.Player.Character, bone, 0.0, -0.18, 0.35, 180.0, 180.0, 0.0, False, False, True, False, 0, True)    End Sub

Is there a way I can more firmly attach the pack so it looks like the pedestrian is wearing it naturally and not floating around? I know that

GTA.Native.Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 9, 9, 0, 2)

attaches the pack to Michael but it doesn't work for any other pedestrian because of their unique components.

 

Thanks

 

unknown modder

Hey All. I am attaching a backpack to any pedestrian skin i chose. The problem is once its fixed onto the ped's bone it 'floats'. If you run the bag lags behind, and if you stand still the bag doesn't move while you character sways back and forth at idle. Here's the code:

Public Sub AddProp_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyDown        If e.KeyCode <> Keys.U Then Return        Dim bone As Integer = GTA.Native.Function.Call(Of Integer)(Hash.GET_HASH_KEY, "SKEL_Neck_1")        Dim bags As Entity = World.CreateProp("prop_michael_backpack", Game.Player.Character.Position, True, False)        GTA.Native.Function.Call(Hash.ATTACH_ENTITY_TO_ENTITY, bags, Game.Player.Character, bone, 0.0, -0.18, 0.35, 180.0, 180.0, 0.0, False, False, True, False, 0, True)    End Sub

Is there a way I can more firmly attach the pack so it looks like the pedestrian is wearing it naturally and not floating around? I know that

GTA.Native.Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 9, 9, 0, 2)

attaches the pack to Michael but it doesn't work for any other pedestrian because of their unique components.

 

Thanks

 

You aren't passing the right argument for the bone parameter. It needs to be the bone index which can be found using

Dim bone As Integer = GTA.Native.Function.Call(Of Integer)(Hash.GET_ENTITY_BONE_INDEX_BY_NAME, Game.Player.Character, "SKEL_Neck_1")

Thanks for the help but no matter how I attach the backpack, changing the native and trying various bones, it acts like its following an invisible placeholder for the skeleton. For instance when I climb a wall it will move up before the player and meet the player once the animation has finished. Its almost as if the skeleton doesn't match the characters animation.

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
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.