English 中文(简体)
Java3D:在世界坐标处轮换物体?
原标题:Java3D: rotating object in world coordinates?

我一直在搜寻所有夜晚,但找不到信息一眼看,甚至可能的话,这种信息非常令人不安。

I m使用Java3D,可以推测如何在世界空间轮换摄像机。

My left/right, and up/down rotation both happen on local space. Meaning that if I move left and right, everything looks fine. However if I look 90 degrees down, then look 90 degrees right, everything appears to be on its side.

目前,我做了以下工作。 这将产生上述效果:

TransformGroup cam = universe.getViewingPlatform().getViewPlatformTransform();
Transform3D trfcam = new Transform3D();
cam.getTransform(trfcam);

trfcam.mul(Camera.GetT3D()); //Gets a Transform3D containing how far to rotate left/right and how far to move left/right/forward/back

trfcam.mul(Camera.GetRot()); //Gets a t3d containing how far to rotate up/down

cam.setTransform(trfcam);

Alternatively, one thing I tried was rotating the root, but that rotates around 0, so if I ever move the camera away from 0, it goes bad. Is there something available on the web that would talk me through how to achieve this kind of thing? I ve tried a lot of different things but just can t seem to get my head around it at all. I m familiar with the concept, as I ve achieved it in Ogre3D, just not familiar with the law of the land in J3D.

提前收到答复:

问题回答

储存每条轴心(x和 y)轮值,如果你试图围绕轴心进行轮值,扭转轮值,轮值为x,轮值为x,然后按轮值轮流。

我不相信我正确理解你的第二个问题。 由于观众和模型转变是双重的,你可以通过改变世界本身来模拟照相移动。 如果你愿意翻译你正在轮值的x和轴心,那么,在你正在使用的主要变革集团中添加另一个转变集团,并在新集团中进行变革。

Edit:第一种解决办法是相当缓慢的,因此,在你必须做的3个改革中,你可以实现变革3D:

你们已经轮值X轴(Translate3D xrot),现在你们需要轮 rotat:

Translate3D yrot = new Translate3D();  
yrot.rotY(angle); 

Translate3D temp = xot; 
xrot.mul(yrot);  // Dont forget the reverse order. xrot is the previous translate 
xrot.mul(yrot);  // xrot = xrot * yrot * xrot^-1
temp.transpose();  // Get the reverse transform of the old transform
xrot.mul(temp);

yrot = xrot;  // Store it for future rotation around x axis
cam.setTransform(yrot); 

它对你们进行的许多转变也发挥了类似作用:扭转了以前所做的转变,改革了老变革。 我希望它能够提供帮助。





相关问题
WPF Rotate 3D sphere to arbitratry position

If I have a sphere that is being rotate by the users mouse, how could I (at any time, say via a button) apply some rotation transformation on the Camera so that a specific spot on the Sphere is facing ...

Table View rotate, but not properly (shape change)

Here is the thing. I have a ViewController which contain a view in full window. And the program run in landscape mode. I want to put an UITableView over the full screen view but only on right half ...

How to rotate an object in C# 3D?

I need to rotate an 3D mesh object on an axis in C#. Could you show me how this is done?

Any free polygon library for the iPhone?

I need a library that can manage polygon modeling and basic transformation like rotating and translating. I d rather not redevelop everything from scratch Thanks

WPF 3d rotation animations

I have a few 3d rectangles on my screen that I want to pivot around the Y axis. I want to press down with the mouse, and rotate the 3d object to a max rotation, but when the user moves their mouse, ...

In Place rotation C++ Practice

I have a working rotating function going for my "items" int array. The code below gets it done, except that im transferring values out unnecessarily. Im trying to acheive the "inplace" rotation. What ...

iPhone: Draw rotated text?

I want to draw some text in a view, rotated 90°. I m pretty new to iPhone development, and poking around the web reveals a number of different solutions. I ve tried a few and usually end up with my ...

热门标签