Version: 2017.1

Cloth.ClearTransformMotion

Switch to Manual
public void ClearTransformMotion ();

Description

Clear the pending transform changes from affecting the cloth simulation.

When the transform of a cloth changes, the cloth will not directly follow that change, but instead, the new positions of the SkinnedMeshRenderer's vertices will affect the cloth through the configured constraints in the next cloth simulation update, so that moving the tranform will result in realistic motion of the cloth.

You can call ClearTransformMotion on the cloth to change this behavior. Calling ClearTransformMotion will move the cloth simulation particles along with the transform, so that the transform movement has no effect on the cloth simulation. This is useful if you want to teleport Characters from one point in the scene to another, without having the cloth suddenly jerk into place.

using UnityEngine;

public class ExampleClass : MonoBehaviour { Vector3 newPosition;

void Start() { transform.position = newPosition; GetComponent<Cloth>().ClearTransformMotion(); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961