2ちゃんねる ■掲示板に戻る■ 全部 1- 最新50    

■ このスレッドは過去ログ倉庫に格納されています

【3Dゲームエンジン】Unity質問スレッド11

232 :名前は開発中のものです。:2014/08/19(火) 16:38:07.64 ID:kx1/iXJi.net
或いはもうちょっとスムーズに動かしたいなら
using UnityEngine;
using System.Collections;
public class test2 : MonoBehaviour {
UISlider sl;
Vector3 pos;
Vector3 dump=Vector3.zero;
public float smthTime=1f;
public float maxSpd=3f;
void Start () {
sl = GameObject.Find("HorizonSlider").GetComponent<UISlider>();
pos = transform.position;
}
void Update () {
pos.x = (sl.sliderValue-0.5f)*10f;
transform.position = Vector3.SmoothDamp (transform.position, pos, ref dump, smthTime, maxSpd);
}
}
とかでもいい。
もう少し簡易にVector3.LerpやVector3.Slerpでもいいだろうし。

総レス数 1007
310 KB
新着レスの表示

掲示板に戻る 全部 前100 次100 最新50
read.cgi ver.24052200