- Home /
Question by
HolBol · Mar 11, 2011 at 09:48 PM ·
clothaccelerationlocalwind
Set local acceleration on cloth?
Is this possible? I've only found external and random acceleration- any way to make it local ?
Comment
Answer by YoungDeveloper · Jul 02, 2019 at 01:02 PM
Use TransformDirection method to easily convert global direction to transform local direction.
using UnityEngine;
public class ClothRenderer : MonoBehaviour
{
public Vector3 externalAcceleration = new Vector3(0f, 0f, -4f);
public Vector3 randomAcceleration = new Vector3(1f, 1f, 0f);
public Cloth cloth;
private void FixedUpdate(){
cloth.externalAcceleration = transform.TransformDirection(externalAcceleration);
cloth.randomAcceleration = transform.TransformDirection(randomAcceleration);
}
}
Your answer
Follow this Question
Related Questions
Accessing local system ( File Browser ) 2 Answers
Unity cloth stops moving (simulating) after a short time? 0 Answers
Cloth problem 2 Answers
Physics on a Robe (Kind of like the "Journey" character) 0 Answers