Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

var thickness: float;
float thickness;
thickness as float

Description

The thickness of the cloth surface.

This is the distance kept between any cloth vertex and and other collider (or other cloth vertex if self-collision is enabled). Any object closer then this distance will collide with the cloth. If this value is too low, you may see the edges of objects intersecting the cloth surface. If this value is too high, you may see noticable distance between the cloth surface and colliding objects or stiffness in cloth motion if self-collision is enabled. Must be larger then zero.

	transform.GetComponent(Cloth).thickness = 0.2;
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        transform.GetComponent<Cloth>().thickness = 0.2F;
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Example() as void:
		transform.GetComponent[of Cloth]().thickness = 0.2F