Scaling geometry. XYZ

Software: Away3D 4.x

John Brookes, Moderator
Posted: 18 September 2011 02:19 PM   Total Posts: 732

Can we have a vector3D for scaling instead of uniform scaling.

subgeometry.as

public function scale(scale : Vector3D):void
{
var len : uint = _vertices.length;
for (var i : uint = 0; i < len; i+=3)
{
  _vertices *= scale.x;
  _vertices[i+1] *= scale.y;
  _vertices[i+2] *= scale.z;
}
invalidateBuffers(_vertexBufferDirty);
}

plus the change in Geometry
public function scale(scale : Vector3D):void

Or am I just missing where scaling on XYZ is smile

   

Avatar
80prozent, Sr. Member
Posted: 18 September 2011 03:34 PM   Total Posts: 430   [ # 1 ]

hi john.

you can size mesh/objectcontainer3d by using scaleX,scaleY or scaleZ.

is that what you are looking for ?

[edit:] ok i think its not what youre looking for. i guess the by using the scaleX on Mesh the geometry data is not scaled, but it appeared scaled cause of the scaled Mesh-Matrix ?
you are looking for a way to scale the geometry (on sepperate axis) while not modify the mesh matrix?

 Signature 

sorry…i hope my actionscript is better than my english…

   

John Brookes, Moderator
Posted: 18 September 2011 03:56 PM   Total Posts: 732   [ # 2 ]

yeah thats doesnt update the vertice positions, just the matrix.
So you cant use it with physics.

   

Avatar
Alejandro Santander, Administrator
Posted: 20 September 2011 02:18 AM   Total Posts: 414   [ # 3 ]

We’ve recently added a method in Geometry.as to do this called “applyTransformation()”.

It bakes a Matrix3D in a mesh to its vertices in object space.

mesh.geometry.applyTransformation(mesh.transform);
mesh.transform.identity(); 
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X