Jump to content

SA: How do you spawn object at bone coordinates?


venid

Recommended Posts

Here is a test script, I want KMB_DUMBBELL_R to spawn at the right hand's position AND with the correct XYZ rotation of the hand

Also I'm aware of opcode 070A and 09A0 to attach object to a bone but it isn't what I'm after,

thread 'test' 
Model.Load(#KMB_DUMBBELL_R)
038B: load_requested_models 

:TEST
wait 0 
if
02D8:   actor $PLAYER_ACTOR current_weapon == 2 
else_jump @TEST
wait 0
04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 
10@ = Object.Create(#KMB_DUMBBELL_R, 1@, 2@, 3@)
wait 2000
Object.Destroy(10@)
Object.RemoveReferences(10@)
wait 0 
jump @TEST

Link to comment
Share on other sites

How to get actor's bone position (GTA SA 1.0):
 

// arg 0 - actor handle
// arg 1 - bone id
// arg 2 - (float) offset X
// arg 3 - (float) offset Y
// arg 4 - (float) offset Z
// return (float)(float)(float) world position x y z
:ACTOR_GET_BONE_POS    
    if
        856D: not actor 0@ defined
    then
        cleo_return 3 0.0 0.0 0.0    
    end
    
    0A96: 0@ = actor 0@ struct
    0AC7: 5@ = var 2@ offset // vector 3d pointer
    0AA6: call_method 0x5E01C0 struct 0@ num_params 3 pop 0 bIncludeAnim 1 iBoneID 1@ vOffset 5@ // CPed__getBonePositionWithOffset
cleo_return 3 2@ 3@ 4@

 

Link to comment
Share on other sites

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

×
×
  • Create New...

Important Information

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