Need equivalent of Transform.TransformPoint() but without using transforms

I want to be able to do the equivalent of this:

var localpos = Vector3(0,0,2);
var tPoint = transform.TransformPoint( localpos );

But without using a transform - so instead:

var pos = transform.position;
// should I use a quaternion instead?
var angle = transform.eulerAngles;
var localpos = Vector3(0,0,2);
var tPoint = // ???

(I realise in this example, it's a bit redundant - my real code would require an empty gameObject added which I don't want.)

The best way of doing that is using a `Matrix4x4` any other method would result in a lot of calculations on your side. You don't need scaling, right? Why don't you want to use a empty GO, it's the easiest way of doing that and you have visual debugging support integrated ;)

Anyways, use `Matrix4x4.TRS` to setup your matrix and don't use eulerangles. Eulerangles have a big problem that they can't represent all possible rotations (transitions to achieve the resulting rotation). That's why we have Quaternions. Even the TRS function needs a Quaternion.

If you have created your matrix you can multiply your point with the matrix. The same matrix is already used inside of a Transform. You can get the matrix with `transform.localToWorldMatrix`.

Some further information on matrices of that type:

http://en.wikipedia.org/wiki/Transformation_matrix


edit

Just came to my mind: I think that should work too:

var rotation : Quaternion;
var position : Vector3;
var localpos = Vector3(0,0,2);

var tPoint = rotation * localpos + position;

(of course without scaling!)