Jump to content

Recommended Posts

Posted

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.

Posted

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
Posted

 

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)
Posted

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...