center pivots to objects

Blitz3D Forums/Blitz3D Programming/center pivots to objects

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Yes, it's easier, but the purpose is to have the model in a correct location in the editor, and after in blitz.
i've tried this for the pivot (according it's work on plane in X format )

SurfaceRef#=GetSurface ( Mesh, 1 )

TFormPoint VertexX(SurfaceRef#,0),0,0,Mesh,0

Xmin#= TFormedX()

TFormPoint VertexX(SurfaceRef#,1),0,0,Mesh,0

Xmax# = TFormedX()

TFormPoint 0,VertexY(SurfaceRef#,0),0,Mesh,0

Ymin#= TFormedY()

TFormPoint 0,VertexY(SurfaceRef#,2),0,Mesh,0

Ymax#= TFormedY()

TFormPoint 0,0,VertexZ(SurfaceRef#,0),Mesh,0

Zmin#= TFormedZ()

TFormPoint 0,0,VertexZ(SurfaceRef#,2),Mesh,0

Zmax#= TFormedZ()

pivotX#=(Xmin#+Xmax#)/2
pivotY#=(Ymin#+Ymax#)/2
pivotZ#=(Zmin#+Zmax#)/2

Well it's give the center pivot of the object.
After that, i position the object with these values negatives to set it on the center of the scene.
then i copy it to another mesh, and place the new mesh in the original location. The new mesh will now rotate on his axe.
It's quiet complicated to do posing in 3D apps with blitz !

Now, i want the object to be facing the camera, but not with pointEntity, the object ( a character map in 2d Plane ) has to rotate only in Y.

I've lakes in math. How to calculate Y according to the camera position ? ( The plane remains static, only rotate in Y)

Is it a simple way for doing what i do ?

Thank's