# Difference between revisions of "Modding:Rotations"

(One intermediate revision by the same user not shown) | |||

Line 93: | Line 93: | ||

} | } | ||

</source> | </source> | ||

+ | |||

+ | ==External links== | ||

+ | * [https://www.mathsisfun.com/definitions/degree-angles-.html degrees and angles] | ||

+ | * [https://www.rapidtables.com/convert/number/degrees-to-radians.html degrees to radiant conversion] for math extension e.g with acoth(x) inverse hyperbolic cotangent argument x<-1 or x>1 rad(x) radiant conversion converts radiant into current unit of angle deg(x) degree. | ||

[[Category: Modding]] | [[Category: Modding]] |

## Latest revision as of 21:14, 12 September 2019

As part of modding rotation is an important element in creating the look or function of parts by orienting them properly. Rotation are given in degrees and followed by a `d`

e.g. `90d`

.

## Contents

# Part rotation

## Transformation rotation

As Cosmoteer does not do actual rotation but flipping instead part rotation in build mode had become a crashing problem. This also affected the placement of doors. As addressed and suggested by Lafiel the mirroring solution was introduced with Cosmoteer 0.11.12 to address these problems. In order to have parts properly rotated for placement mirror parts have to be created along with the original part. In the original part it must be specified and linked to the mirror part for its replacement when rotated. The necessary mirroring matrix has to be added. The matrix can be different for different form types.

```
FlipHRotate = [0, 3, 2, 1]
FlipVRotate = [2, 1, 0, 3]
UsePartWhenFlipped = MyMirrorPart
```

## UI rotation

For icons used for selecting parts in the UI separates transformation `UVRect`

has to be added for mirror parts.

```
EditorIcon
{
Texture
{
File = "icon.png"
SampleMode = Linear
}
UVRect
{
Left = 1
Right = 0
Top = 0
Bottom = 1
}
Size = [32, 16]
}
```

In order to prevent axial resizing miss-alignment textures must have even 2x tile sizes.

For blueprints see Texture rotation - Transformation rotation.

# Component rotation

A whole component can be rotated which is applied to all sub-components and textures. The rotation point is the same as the location.

```
MyGraphics
{
Type = Graphics
Location = [x, y]
Rotation = 90d
}
```

## Turrets

A turret must always be rotated `-90d`

in order to face forward. Anything chained to the turret will also be rotated along. In order to align them they have to reverse their rotation. Also off-center coordinates have to be adjusted to the new orientation to be properly aligned.

# Texture rotation

Textures can be rotated independently from their component if desired. The rotation point is the same as the location.

## Crew rotation

Crew and texture rotation are the same except center alignment isn't perfect and may require adjustments.

## Transformation rotation

For special cases like mirroring an UV transformation can be used instead. The `MirrorU`

or `MirrorV`

has to be enabled.
Sequence priority is mirrors first and then rotation!

```
BlueprintSprites
[
{
File = "blueprints.png";
MirrorU = true
Size = [2, 4];
Offset = [0, 0];
}
]
```

UV rotation is done by using `UVRotation`

.

```
Texture
{
File = "floor.png"
UVRotation = 1
Size = [1, 1]
}
```

## External links

- degrees and angles
- degrees to radiant conversion for math extension e.g with acoth(x) inverse hyperbolic cotangent argument x<-1 or x>1 rad(x) radiant conversion converts radiant into current unit of angle deg(x) degree.