質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
C#

C#はマルチパラダイムプログラミング言語の1つで、命令形・宣言型・関数型・ジェネリック型・コンポーネント指向・オブジェクティブ指向のプログラミング開発すべてに対応しています。

Unity3D

Unity3Dは、ゲームや対話式の3Dアプリケーション、トレーニングシュミレーション、そして医学的・建築学的な技術を可視化する、商業用の開発プラットフォームです。

Q&A

解決済

1回答

1665閲覧

Unityのスクリプトの書き方

murabito7

総合スコア1

C#

C#はマルチパラダイムプログラミング言語の1つで、命令形・宣言型・関数型・ジェネリック型・コンポーネント指向・オブジェクティブ指向のプログラミング開発すべてに対応しています。

Unity3D

Unity3Dは、ゲームや対話式の3Dアプリケーション、トレーニングシュミレーション、そして医学的・建築学的な技術を可視化する、商業用の開発プラットフォームです。

0グッド

0クリップ

投稿2021/08/14 11:21

Unityに関しての質問です
出来れば早急にお願いしたいです!

ジェットコースターを作っています。アセットストアのBezier Path Creatorというアセットを使っていてパスを作り終えたのですが、コースターが上昇したり下降したりするところの速度を変えたくてどうすればいいか分かる方教えて頂きたいです。
今はInspectorの中にスピードを書ける欄が1つしかないです。アニメーションは無くて一定速度では動いています。

一応こちらが多分スピードに関わるスクリプトかと思います。
using UnityEngine;

namespace PathCreation.Examples
{
// Moves along a path at constant speed.
// Depending on the end of path instruction, will either loop, reverse, or stop at the end of the path.
public class PathFollower : MonoBehaviour
{
public PathCreator pathCreator;
public EndOfPathInstruction endOfPathInstruction;
public float speed = 5;
float distanceTravelled;

void Start() { if (pathCreator != null) { // Subscribed to the pathUpdated event so that we're notified if the path changes during the game pathCreator.pathUpdated += OnPathChanged; } } void Update() { if (pathCreator != null) { distanceTravelled += speed * Time.deltaTime; transform.position = pathCreator.path.GetPointAtDistance(distanceTravelled, endOfPathInstruction); transform.rotation = pathCreator.path.GetRotationAtDistance(distanceTravelled, endOfPathInstruction); } } // If the path changes during the game, update the distance travelled so that the follower's position on the new path // is as close as possible to its position on the old path void OnPathChanged() { distanceTravelled = pathCreator.path.GetClosestDistanceAlongPath(transform.position); } }

}

よろしくお願いします????‍♂️

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

スクリプト書き換えたら何とか出来そうです。

投稿2021/08/15 03:23

murabito7

総合スコア1

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問