言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

SkinnedCloth.SetEnabledFading

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public function SetEnabledFading(enabled: bool, interpolationTime: float = 0.5f): void;
public void SetEnabledFading(bool enabled, float interpolationTime = 0.5f);
public def SetEnabledFading(enabled as bool, interpolationTime as float = 0.5f) as void

Description

シミュレーションのフェードイン/フェードアウト、および有効/無効を設定します

This function lets you enable or disabe the SkinnedCloth component, by setting the enabled parameter. Unlike setting the /Cloth.enabled/ property directly, this will delay the action, and smoothly interpolate the mesh between the normal skinned mesh and the cloth simulation over a time of /interpolationTime/ seconds. This helps you to turn on and off clothing simulation on characters without letting users notice the transition. Turning on and off clothing simulation is useful for managing the performance of your game, as cloth simulation is rather expensive. Calling this function repeatedly with the same parameters has no additional effect.

	/// Smoothly turn cloth simulation on or off depending on distance to camera.
	var simulateCloth = true;
	if ((transform.position - Camera.main.transform.position).sqrMagnitude > 20.0f * 20.0f)
		simulateCloth = false;
	GetComponent(SkinnedCloth).SetEnabledFading (simulateCloth);
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public bool simulateCloth = true;
    void Example() {
        if (transform.position - Camera.main.transform.position.sqrMagnitude > 20.0F * 20.0F)
            simulateCloth = false;
        
        GetComponent<SkinnedCloth>().SetEnabledFading(simulateCloth);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public simulateCloth as bool = true

	def Example() as void:
		if (transform.position - Camera.main.transform.position).sqrMagnitude > (20.0F * 20.0F):
			simulateCloth = false
		GetComponent[of SkinnedCloth]().SetEnabledFading(simulateCloth)