Dynamically Resizing Models

From The DarkMod Wiki
Jump to navigationJump to search

Originally written by Ishtvan on http://forums.thedarkmod.com/topic/2986

There's been a lot of questions about whether we can dynamically resize an entity ingame. Well, I think I did this by accident the other day. The key seems to be the following function:

void idEntity::SetAxis( const idMat3 &axis )

This is meant to re-orient the object to a given axis, and usually the axes are normalized so that each vector in the axis keeps a lenght of "1" and it doesn't rescale the entity. However, when I accidentally put a non-normalized vector in there, it actually shrank the object down. This happened for one of the crates in test_water. It was a result of a bug in my code, but I could get it to shrink down to about 1/4th its size and then come back up to the normal size. Pretty crazy.

It didn't mess up the textures or anything either, they seemed to stretch along with the object so that they kept their mapping coordinates relative to the object.

I got rid of the code since then since it didn't do what I wanted, but just thought this should be documented in case we want to dynamically shrink/expand brushes later.

Mappers can also do this using the "rotation" key.

Important

This method (also known as "rotation hack") is not recommended, as it is reported to screw up the lighting (i.e. the normals) and the collision model. Use this at your own risk.