|
bardo, Member
Posted: 15 March 2012 03:28 PM Total Posts: 79
hi all , i have a lot of plane on my scene, i want to position them in spare order in front of the camera (like photos on a table ... like a 2d view) .
i can find a single position in front of the camera
var positionCamera:Vector3D = Matrix3DUtils.getForward(camera.transform); var newPos:Vector3D = new Vector3D( camera.position.x + positionCamera.x*200, camera.position.y + positionCamera.y*200, camera.position.z + positionCamera.z*200 )
but ... How can i move the planes on their local x and y , mantaining the orientation ?
i’ll pay a beer or a Coca cola to the first able to give me the solution !
Thanks!
EDIT : SOLVED : i create a plane container , added each plane to planeContainer , translate the inner plane on local X and local Y . This is a ‘trick ’ : if somebody know and want to explain how to achieve the same effects , with math only : PLEASE POST!
Thank Vice and 3dnewb for the patience!
|
bardo, Member
Posted: 16 March 2012 08:19 AM Total Posts: 79
[ # 1 ]
bump ... do somebody have any idea?
|
Vice, Member
Posted: 16 March 2012 08:51 AM Total Posts: 58
[ # 2 ]
you want all the planes facing at the camera and each plane has a diffrent position so the distance from the camera will increase wich each row?
|
bardo, Member
Posted: 16 March 2012 08:54 AM Total Posts: 79
[ # 3 ]
no ... i want them them to maintaint the same orientation as camera , the same distance , but they have to fill the view ... like photos in random order on a table
|
3dNewb, Sr. Member
Posted: 16 March 2012 10:55 AM Total Posts: 105
[ # 4 ]
I would like to help out, but to me it is not entirly clear what you mean, can maybe put up a small sketch (just a few lines) of your problem?
|
|
3dNewb, Sr. Member
Posted: 16 March 2012 11:11 AM Total Posts: 105
[ # 6 ]
have you tried:
plane.rotation = camera.rotation
or these steps:
plane.position = camera.postion + a little bit (so that is is in front of the camera)
plane.lookat(camera); So that it is faceing the camera
plane.position.x,y,z = your new position, you move it away from the camera but it is still in the same rotation
Just what I can think of right now.
|
bardo, Member
Posted: 16 March 2012 11:16 AM Total Posts: 79
[ # 7 ]
ill give a try and post results!
|
Vice, Member
Posted: 16 March 2012 11:20 AM Total Posts: 58
[ # 8 ]
or using Sprite3D…
...but lookAt dont work in this case.
|
bardo, Member
Posted: 16 March 2012 11:38 AM Total Posts: 79
[ # 9 ]
i ended with this
var positionCamera:Vector3D = Matrix3DUtils.getForward(camera.transform); var newPos:Vector3D = new Vector3D( camera.position.x + positionCamera.x*-Utils3d.pixelPerfectCameraValue(camera,450), camera.position.y + positionCamera.y*-Utils3d.pixelPerfectCameraValue(camera,450), camera.position.z + positionCamera.z*-Utils3d.pixelPerfectCameraValue(camera,450) ) var dummy:ObjectContainer3D = new ObjectContainer3D(); dummy.position = newPos; dummy.lookAt(camera.position); for (var i:int = 0; i < _itemList.length; i++) { var obg:ObjectContainer3D = _itemList[i]; var m:Matrix3D = dummy.transform.clone(); var minus:int = (Utils.randRange(0, 1) == 0) ? -1 : 1; m.appendTranslation(Math.random()*1000*minus,Math.random()*1000*minus,0) }
that ended in this
https://www.socialnetworkserver.it/wrball
.... i think ITS NOT the right direction after all ... the distance in not the same for every plane
|
bardo, Member
Posted: 16 March 2012 11:50 AM Total Posts: 79
[ # 10 ]
if i limit the translation on the Y
var m:Matrix3D = dummy.transform.clone();
var minus:int = (Utils.randRange(0, 1) == 0) ? -1 : 1;
m.appendTranslation(0,Math.random()*1000*minus,0)
the result is correct (obviously correct only for the Y axis)... how can i retrieve the Vector where i have to do the translation for the ‘X’ ?
|
John Brookes, Moderator
Posted: 16 March 2012 04:18 PM Total Posts: 732
[ # 11 ]
Make sure the Yup parameter of your plane is true (or maybe false) sorry not testing
Then
give the plane the exact same rotation/position as the camera.
yourPlane.transform = camera.transform
then use moveBack moveForward etc to position
yourPlane.moveForward(1000); //may be back not tested
yourPlane.moveLeft(200)
|