Hopper31 Posted May 15, 2014 Share Posted May 15, 2014 Just as the title say, I'm trying to find something similar to the GetHeadingAngle command for the x axis, as I want a NPC to aim at (but not fire at) an object that is moving up and down. Link to comment Share on other sites More sharing options...
Belthan Posted May 16, 2014 Share Posted May 16, 2014 I don't think there's an equivalent function. The following should work (assuming you've already set the z angle), but trig functions are slow so this might not be practical to run every frame, particularly on slower PCs. FLOAT Hypotenuse FLOAT Opposite FLOAT Fraction FLOAT Angle Set Opposite to (targetREF.Getpos z - npcREF.GetPos z) Set Hypotenuse to npcREF.GetDistance targetREF Set Fraction to Opposite / Hypotenuse Set Angle to Sin Fraction 1 Link to comment Share on other sites More sharing options...
jazzisparis Posted May 16, 2014 Share Posted May 16, 2014 Set Opposite to (targetREF.Getpos z - npcREF.GetPos z)You would want to switch places here, as the X angle is negative when looking up: Set Opposite to (npcREF.Getpos z - targetREF.GetPos z) Link to comment Share on other sites More sharing options...
Hopper31 Posted May 17, 2014 Author Share Posted May 17, 2014 Thanks for the help guys! Unfortunately it did not turn out the way I thought it would. So I guess I'll have to deal with my old method. Link to comment Share on other sites More sharing options...
Recommended Posts