Jump to content

Search head angle.


Recommended Posts

Hello everyone, I need found head angle (bone), rot Y:

d4e6eedecacd.png

Function getPedBoneRotation do not have.

And I make this:

PosXr, PosYr, PosZr = getPedBonePosition (localPlayer, 6) 
PosXl, PosYl, PosZl = getPedBonePosition (localPlayer, 7) 
  
vectorX, vectorY, vectorZ =  PosXl - PosXr, PosYl - PosYr, PosZl - PosZr 
         
longVector = math.sqrt( (vectorX*vectorX) + (vectorY*vectorY) + (vectorZ*vectorZ) ) 
longProjections = math.sqrt( (vectorX*vectorX) + (vectorY*vectorY) ) 
  
roll = math.deg( math.acos( ( ( vectorX * vectorX + vectorY * vectorY ) / ( longVector * longProjections  ) ) ) ) 

And need make this: rightRoll = math.pi - roll, when deployed angle.

Code not important, look for algorithm.

But it's bad works with anim.

Maybe exist better method?

I hope you understand me.

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...