View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# 3D Scale an object in spaces other than local-space

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

No replies to this topic

### #1Koder4Fun  Members

Posted 27 March 2012 - 10:14 AM

I've writed code for manipulating and transforming objects with on-scene manipulators like 3dsmax, maya ecc...
The translation and rotation work well in local and world spaces, but I can't figure out the scaling from a world-space manipulator.

The transform of an object is splitted in three fields:
		private Vector3 m_translation;
private Quaternion m_rotation;
private Vector3 m_scale;


a final transform matrix is maded this way:
		public Matrix Transform
{
get
{
return Matrix.CreateScale(m_scale) *
Matrix.CreateFromQuaternion(m_rotation) *
Matrix.CreateTranslation(m_translation);
}
}


Now, when I scale an object with a local-space manipulator the result is correct,
when I scale an object with a world-space manipulator the result is wrong.

I.E.:
- I rotate an object for example by 45° around the vertical axis (Y axis)
- I set the manipulator mode to world-space, so the manipulator axes are now parallel to world-space basis vectors

scaling along X axis I'm aspect that the scaling vector must show some values on X and Z components (due to previous rotation) and the object must "slide" along the world X axis, but the object scale in some strange way.

This can depend to scale-rotaton-translation sequence? i must change sequence?
It's always possible to scale an object with values specified in another than local-space?

Thanks in advance for the help...and sorry for the english

A last note: I'm using XNA 4.0, NET 4.0 and C#