Scale, Dimensions and resizing CollisionHelpers

From Frozenbyte Wiki
Jump to: navigation, search
File:Default scale coll help.png
Default Scale (VC3(1, 0.2, 5)) of RockCollisionHelper
File:Cube scale coll help.png
Cube Scale (VC3(1, 1, 5)) of RockCollisionHelper
File:1 1 1 scale coll help.png
1:1:1 Scale (VC3(1, 1, 1)) of RockCollisionHelper

For most objects the Scale property of it's ModelComponent is and should be VC3(1,1,1), because the objects aren't meant to be scalable but rather used in their default size. This is different for CollisionHelpers, which don't have textures on them that will get ruined by rescaling the object. Since CollisionHelpers are meant to bind the player and other game objects inside some volume, they also have a separate BoxPhysicsCollisionComponent that determines the size of the collision area (through which game objects can't travel) of said CollisionHelper. This BoxPhysicsCollisionComponent has a separate property for it's size, which is called Dimensions.

When the size of the CollisionHelper is changed with the Scale tool, the Scale and Dimension properties both get resized correctly. If either of these is instead changed by hand from the properties, the other one has to be changed to fit the new size manually as well. Otherwise there's a discrepancy between the size of the model of the CollisionHelper (Scale), which is supposed to represent the area through which the game objects can't travel, and the actual size of the area itself (Dimensions).

If one wants to change these values by hand from the properties of the objects, it's good to know the relation between the Scale and Dimensions properties and their default values.

Scale

As said before, Scale is and should usually be VC3(1,1,1) for most of the objects. It's a ratio between the size of an instance of an object in the scene and the default size of the same object. VC3(1,1,1) means the instance is 1:1 with the default size of the object. VC3(2,2,2) means the instance is twice the size of the default size in every dimension.

For CollisionHelpers this is slightly different. The default value of the Scale property of CollisionHelpers is VC3(1, 0.2, 5). For some unknown reason (legacy of 2D?) the value of the z-component needs to be five (5) times larger compared to x- and/or y-component for it to be equal size in the scene. So to create a CollisionHelper shaped like a cube, the Scale needs to have equal x- and y-components and five times larger z-component.

Dimensions

Instead of Scale, which is just a ratio, Dimensions property is in "editor meters". The default Dimensions of a CollisionHelper is VC3(2.5, 0.5, 2.5). This corresponds to the default Scale VC3(1, 0.2, 5). Very noteworthy thing here is that the z-component of Dimensions should be equal to x- and/or y-component instead of being five (5) times larger like with Scale, for it to be equal size in the scene. This can lead to some serious confusion at first and should be kept in mind when changing the properties manually.

Ratio between Scale and Dimensions

Since it might be slightly confusing how the x-, y- and z-components of Scale and Dimensions are related to each other, here are some simple relations between the different values. The relations are shown as a ratio (e.g. 1:1:1).

  • Scale x : y : z = 1 : 1 : 5
  • Dimensions x : y : z = 1 : 1 : 1
  • Scale x : Dimensions x = 1 : 2.5
  • Scale y : Dimensions y = 1 : 2.5
  • Scale z : Dimensions z = 2 : 1