In the script, I use create_orientation to get a rotation facing the target position:
Code: Select all
<create_orientation name="$rot" orientation="look_at" refposition="$pos">
<position object="this.ship" />
</create_orientation>
Code: Select all
<move_to object="this.ship" destination="this.zone" usehighways="false" forceposition="false" forcerotation="true" avoid="false" >
<position object="this.ship" z="5m" />
<rotation value="$rot" />
</move_to>
[-2303m, 642m, 859m] is the position of our ship...
[-4401m, -14477m, 15833m] is the target position.
You can see the target position is 15km away on the z-axis, and about 15km below on the y-axis too. So we should expect to see a pitch of about 45 degrees downwards. But printing the value of $rot gives [-7.9deg, 0, -0deg] for yaw, pitch and roll! And sure enough, the ship levels out completely during the move_to.
Am I missing something here? I know create_orientation has a "maxpitch" attribute, but it defaults to no pitch restriction. And there is no atan2 function for me to hack together a pitch value.
Anyone have any insights?