Question by
eitanwass · May 12, 2016 at 06:00 PM ·
spawnontriggerentersmoothfpscontrollervector3.movetowards
Help with moving player smoothly to some place
I'm using the default FPSController and i want that when my player goes into a trigger he floats smoothly upwords to the spawn point.
code: using UnityEngine; using System.Collections;
public class DeathSentence : MonoBehaviour {
Vector3 Spawn = new Vector3(0, 2, 18);
public int smooth = 10;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter(Collider collidedObject){
Debug.Log ("Touched");
collidedObject.transform.position = Vector3.MoveTowards (collidedObject.transform.position, Spawn , Time.deltaTime * smooth);
}
}
I don't know what the problem is. Please help me.... -Ethan
Special Invites: @dhore
Comment
Your answer
Follow this Question
Related Questions
Rotate smoothly on sphere 2 Answers
SmoothDamp bug? 0 Answers
Custom touch control stops abruptly! 0 Answers
Script component seems to be missing when spawning prefab? 2 Answers
Make a collision check when spawning with Instantiate 1 Answer