# New TCastleTransformReference class, to efficiently reference another TCastleTransform within the same viewport

**URL:** <https://forum.castle-engine.io/t/new-tcastletransformreference-class-to-efficiently-reference-another-tcastletransform-within-the-same-viewport/502>\
**Category:** News\
**Created:** [January 22, 2022, 6:05pm UTC](https://forum.castle-engine.io/t/new-tcastletransformreference-class-to-efficiently-reference-another-tcastletransform-within-the-same-viewport/502 "2022-01-22T18:05:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)\
**Post date:** [January 22, 2022, 6:05pm UTC](https://forum.castle-engine.io/t/new-tcastletransformreference-class-to-efficiently-reference-another-tcastletransform-within-the-same-viewport/502/1 "2022-01-22T18:05:04Z")

</div>

| [![Multiple cars](https://castle-engine.io/wp/wp-content/uploads/2022/01/cars_demo_2-200x125.png)](https://castle-engine.io/wp/wp-content/uploads/2022/01/cars_demo_2.png "Multiple cars") |

I implemented `TCastleTransformReference` to reference another `TCastleTransform` within the same viewport. This is an efficient way to use the same `TCastleTransform` multiple times, which is great for memory and speed. Consider using this when you need a _lot_ of copies of something, e.g. lots of trees or grass patches.

All the `TCastleTransformReference` instances share the same state with the original, e.g. they will play the same animation. In practice, you will probably most often use this with static (not animated) models.

[The detailed usage documentation is already part of the manual, at the bottom of “Tutorial: Designing a 3D world”](https://castle-engine.io/viewport_3d#_multiple_instances_of_the_same_scene_using_tcastletransformreference) page.

Note: from code, you can even just place the same `TCastleTransform` instance multiple times within the same viewport using code, even without `TCastleTransformReference`. [This is documented too.](https://castle-engine.io/viewport_and_scenes_from_code#_multiple_instances_of_the_same_scene)
