这是我的代码:
private Quaternion getRotatedQuaternion(float pitch, float yaw, float roll) {
tempQuat.setEulerAngles(pitch, yaw, roll);
rotationQuat.mulLeft(tempQuat);
return rotationQuat;
}
和
camera.view.setToLookAt(tempPos, tempLookat, Axis.UP);
Quaternion rotQuat = getRotatedQuaternion(gestureListener.getXAngle(), gestureListener.getYAngle(), 0);
camera.view.rotate(rotQuat);
camera.combined.set(camera.projection);
Matrix4.mul(camera.combined.val, camera.view.val);
这是相机在中心的旋转,位于0,0,0。通过这种方式解决了万向节锁问题。但是我该如何为它添加一个新的中心点?
基本上我想围绕我的物体旋转相机,而不是0,0,0
由于
答案 0 :(得分:0)
我认为你能做到的唯一方法就是首先将相机移动到物体的位置,旋转,然后将相机移回原位。
类似于:
#<...>
# Source and target DB passwords
arg_source_password=your_sorce_password
arg_target_password=your_target_password
if [ -z "$arg_source_password" ] && [ -z "$arg_target_password" ] ; then
echo WARNING: Both source and target RDBMSes passwords are empty. You should edit this file to set them.
fi
arg_worker_count=2
# Uncomment the following options according to your needs
# Whether target tables should be truncated before copy
# arg_truncate_target=--truncate-target
# Enable debugging output
# arg_debug_output=--log-level=debug3
/home/milosz/Projects/Oracle/workbench/master/wb_run/usr/local/bin/wbcopytables \
--mysql-source="root@localhost:8000" \
--target="root@localhost:8000" \
--source-password="$arg_source_password" \
--target-password="$arg_target_password" \
--thread-count=$arg_worker_count \
$arg_truncate_target \
$arg_debug_output \
--table-where '`test`' '`t1`' '`test_target`' '`t1`' '`id`' '`id`' '`id`, `name`, `date`' '`date` >= "2017-01-02" and `date` <= "2017-01-03"'
答案 1 :(得分:0)
您需要将极坐标(r,θ)转换为笛卡尔坐标(x,y) 公式如下:
x = r×cos(θ)
y = r×sin(θ)
角度相对于物体中心点(0º到360º),半径是物体到相机的距离。
这是一个为您完成的简单方法:
public static Vector3 returnPosArroundObj(Vector3 posObject, Float angleDegrees, Float radius, Float height) {
Float angleRadians = angleDegrees * MathUtils.degreesToRadians;
Vector3 position = new Vector3();
position.set(radius * MathUtils.sin(angleRadians), height, radius * MathUtils.cos(angleRadians));
position.add(posObject); //add the position so it would be arround object
return position;
}
答案 2 :(得分:-1)
我最终得到了两个matrox旋转和一个用作弧形旋转的矢量