Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Move a camera ()first preson view) smoothly along a 3D spline using keyboard input

Discussion in 'Editor & General Support' started by kenmarold, Jul 16, 2023.

  1. kenmarold

    kenmarold

    Joined:
    Jun 11, 2015
    Posts:
    27
    I need to move a camera smoothly along a 3D spline using keyboard input (up arrow key = forwards, down arrow key = backwards). Is there a simple way to do this? I've been searching for a tutorial on this but haven't been able to find anything. Thanks in advance for any help or insight on this!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    Steps to success:

    - Use any spline follower that takes a time T input and gives you parametric positions.

    - map up and down keys to increase / decrease T

    Done!

    I use the Bezier Solution asset from the Asset store. Does this perfectly.
     
  3. kenmarold

    kenmarold

    Joined:
    Jun 11, 2015
    Posts:
    27

    Thanks Kurt! One other question as I'm a bit of a coding novice. Are there any tutorials that you would recommend that might be able to walk me through this implementation?
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    None I know of that you can't find with Google.

    Here is the strategy you want: ask yourself "Can I ...?" again and again.

    Imphenzia: How Did I Learn To Make Games: