如何获得两个向量方向(p1,p2)? [英] How to get the vector direction between two (p1, p2)?

查看:427
本文介绍了如何获得两个向量方向(p1,p2)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在Unigine工作,并试图编写飞行程序几个星期,我需要找到两个虚拟节点之间的方向,所以我可以使用这个方向旋转飞机的翅膀。

I have been working on Unigine and been trying to code a flight program for weeks, I need to find the direction between two dummy nodes so I can use this direction to rotate the wings of the aircraft. Any explanation would be appreciated.

推荐答案

首先,您必须计算P1和P2之间的距离长度。

First you have to calculate the length of the distance between P1 and P2.

distance = abs(P2(y) - P1(y))

然后,您可以使用角度函数计算角度。

Then you can use the angular functions to calculate the angle.

a = sin(distance / length(P12))

这篇关于如何获得两个向量方向(p1,p2)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆