我可以在不使用任何OpenGL 或任何第三派工具的情况下使用旋转动画吗?我只想在 fix layout.you 中应用顺时针旋转的 3D 汽车对象。
问问题
835 次
2 回答
0
除非你有某种模拟 3D 汽车的精灵动画序列,否则老实说,我不明白你是如何做到的。虽然我可能错了,并且可能错过了 android 中的某些内容,但对我来说,这是一个经典的 openGL 情况。
精灵动画也指任何类型的 2D 图像序列,例如动画 gif。
于 2012-07-16T09:15:26.893 回答
0
1) Well, you first have to set the car in 3D space;
To model a 3D object, you must define all the vertices of the car as if you were modeling with points and after , linking this point you get the car in wireframe.
Pont A {x = 3, y = 10, z = 8}
Point B {x = 5, y = 12, z = 2}
Point C {x = 6, y = 40, z = 6}
Point D {x = 7, y = 12, z = 3}
Point E {x = 3, y = 10, z = 8}
...
2) After modeling the car in points, you must define the links of points to form lines, there you have called wireframe modeling, if you want to modeling shapes is different, but with the wireframe already a good idea of the object in the real world.
Line AB = Point A -> Point B
Line BC = Point B -> Point C
3) To spin perfectly the car, you should position it in the center of coordinates,applying in each point the formula translation T with measure the match the distance to the subject from the center at the origin of the axes.
New point x:
x = x - Tx
New point y;
y = y - Ty
New point z:
z = z - Tz
4) With the car in position to spin it into an angle "g" should be applied to each point the rotation transformation, the formula is:
Find the new point x:
xt = (x * 1) (* y 0) (z * 0);
Find the new point y:
yt = (X * 0) (y * Math.cos (g)) (z * (Math.sin-(g)));
Find the new point z:
zt = (X * 0) (y * Math.sin (g)) (z * Math.cos (g));
5) After applying the rotation effect, you must return the object to its point of origin, making a reverse translation to step 3.
New point x:
x = Tx x
New point y;
y = y Ty
New point z:
z = z Tz
This is a roughly explanation but is the most basic way, of course it has more complex formulas that are faster these changes, but to become more didactic I put this way.
于 2013-07-17T21:59:20.843 回答