Here is a short example of what i 've got :
package
{
import away3d.containers.ObjectContainer3D;
import away3d.containers.View3D;
import away3d.core.base.Vertex;
import away3d.core.math.Number3D;
import away3d.geom.Explode;
import away3d.primitives.Plane;
import away3d.primitives.Sphere;
import flash.display.Sprite;
import flash.events.Event;
/**
* ...
* @author Ghislain Flandin
*/
public class Main extends View3D
{
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
x = this.stage.stageWidth / 2;
y = this.stage.stageHeight / 2;
camera.z = -900;
camera.y = 0;
var plane:Plane = new Plane( { width:256, height:91,
segmentsW:8,
segmentsH:7 ,rotationX:90} );
//scene.addChild(plane);
var exploder:Explode = new Explode(true, true);
var exploded:ObjectContainer3D = exploder.apply(plane)
as
ObjectContainer3D;
var containerExploded:ObjectContainer3D = new
ObjectContainer3D();
scene.addChild(containerExploded);
containerExploded.addChild(exploded);
//containerExploded.rotationX = 90;
//use a sphere to position my triangles
var sphere:Sphere = new Sphere( {segmentsW:11,
segmentsH:11, radius:
150} );
//scene.addChild(sphere);
for (var i:int = 0; i < sphere.vertices.length; i+=1)
{
var vertex:Vertex = sphere.vertices[i];
exploded.children[i].x = sphere.vertices[i].x;
exploded.children[i].y = sphere.vertices[i].y;
exploded.children[i].z = sphere.vertices[i].z;
exploded.children[i].lookAt(new Number3D());
}
render();
}
}
}
I hope you could help me !!!
Thanks a lot !
Ghislain
On 10 déc, 19:17, Ghislain Flandin <[email protected]> wrote:
> Thanks for your answer !!!
>
> In fact, what i'd like to do is :
>
> 1. take a Plane and explode it into triangles (i made it !!!)
> 2. distribute all these triangles on a sphere (i made it too !!! )
> 3. I d'like to position them on the sphere like this
> :http://forum.papervision3d.org/viewtopic.php?f=20&p=4989
>
> The problem I have now is that i can't find a way to get the good
> rotation angle to do that.
>
> I think i have to use Quaternion but i don't understand anything about
> Quaternion.
>
> Thanks for your help !!!
>
> On 10 déc, 17:56, tain <[email protected]> wrote:
>
> > if plane is (n*m)
> > sphere is (n*(m-2)+2) number of vertices.
>
> > i am correct?
>
> > current away3d sphere can be described as a plane with the top and
> > bottom row vertices merged into 1 vertex. thus losing some of triangle
> > count.
>
> > but i didnt quite understand what is your goal so i dont know how to
> > help you more.
>
> > maybe this?http://www.studiodynamics.net/uv/uv_editor_1.gif
>
> > On Dec 10, 12:39 pm, Ghislain Flandin <[email protected]> wrote:
>
> > > Hello everybody,
>
> > > I'm new in Away3D and i'd like to know something.
>
> > > Is there a formula to create a Sphere (segmentW number and SegmentH
> > > number) taking into account a vertice number?
>
> > > I explain :
>
> > > I explode a Plane with segmentW = n and segmentH = m , so i have (n*m)
> > > *2 triangles after exploding (thanks to the Explode class).
>
> > > Then i want to distribute all these triangles on a sphere, so i built
> > > a Sphere and get the coordinates of each vertex of this sphere.
>
> > > The problem i have is that i want (if it's possible) to get the same
> > > number of triangles ( from my exploded plane) as the vertice (from my
> > > sphere).
>
> > > Is there a way to do that ?
>
> > > Thanks for your help !
>
> > > Ghislain