-
Puting a square movieclip inside 4 3d points
There are four 3d points of a square and I want my movieclip to be that square. I can easliy calculate the center position but I can't calculate the rotationX,rotationY and rotationZ of the movieclip. Is there any other way?
Can you please help me?
-
It will be very hard to calculate those values from 4 points. You should use drawTriangles method and put all 4 coordinates - flash will display it properly.
-
I also tried it but when the square goes in front of the screen or somehow calculations go wrong: http://www.swfcabin.com//swf-files/1309001022.swf
-
You have four points:
AB
CD
You draw two triangles and it looks like both has coordinates ACD and CDB (should be DBA). Could be also problem with texture coordinates.
-
Both things are correct it has something to do with the T values (focalLength/(focalLength + z).
t value of the upper left corner goes like this:
0.4688877681361125
0.4980771996419072
0.5312287312353987
0.5691950758138303
0.6130925971297903
0.6644117319549809
0.7251879822366941
0.7982761394278287
0.8878085868407571
0.9999999999999991
1.144647922926617
1.3381495096442009
1.6101835787010428
2.020572753703822
2.710577936530085
4.112973857744241
8.505448511997727
-129.51869848202483 ********* this is where it starts to happen
-7.53542481599268
-3.885802291436719
-2.620512758445331
-1.9784685303563248
-1.590281169788556
-1.3303150505932697
-1.14409921962679
-1.00418983659365
-0.8952573325826455
-0.8080664129552478
-0.7367213823408194
-0.6772817626492885
-0.6270138389008615
-0.5839615639197313
-
Try to move whole object in z axis (to be sure that z coordinates are always positive). If it does not help please write some you formulas which you use.
-
yes that solved the problem but I want to make a skybox like http://blog.jidolstar.com/574 . I don't know how can I make it without negative z values.
-
Try to modify your perspective projection formula and use abs(w) instead of w.
-
Thank you so much! problem is solved. here is my latest 3d game if you want to see: http://www.games121.com/2011/02/monster-chamber.html
-
I realised that it is impossible to make a skybox with abs. It doesn't look real no matter what the focallength is.
-
Give us url to skybox, maybe we can improve it a bit ;-)
-
http://www.mediafire.com/?i4mo3ncbit1n45s
remove
z1+=1000
z2+=1000
z3+=1000
z4+=1000
lines to see it with negative z values.
-
Sorry but currently I do not have flash installed. I can check only flex applications.
-
I solved the problem and made an skybox with away3d. I am going to use away3d only for the skybox in my game. I can rotate the view in the X and Y axises using camera.tilt and camera.pan BUT I have to rotate the view in the Z axis and Y axis (It's a flight game). scene.rotationZ is no good when the camera is tilted.
I am trying to solve this problem for nearly a day. Is there a way to rotate the camera in the Z axis? Maybe you can help me.
-
I do not know Away3d, but normally you can change rotation in the Z axis by changing up vector of camera.
-
lookat(vec1,vec2) worked. thank you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|