Search Unity

How to attach object to spline path?

Discussion in 'General Discussion' started by barisckr99, Apr 25, 2020.

  1. barisckr99

    barisckr99

    Joined:
    Apr 23, 2020
    Posts:
    1
    Hello guys,

    I have two questions. I will make a game like rollercoaster but I need to attach my object to spline path. How can i do it ?

    And i want to: It will be play gravity. When i touch to screen, it will go along the way. Please help..
    Screenshot_10.jpg
     
  2. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,971
    what is a spline path? a new Unity feature? because if it is that's pretty cool

    anyway the spline path should have a function, you give it a float from 0 to 1, and it returns a Vector3 position ... 0 is the start of the spline, 1 the end

    so you just give the function the touch X screen position divided by the screen width
     
  3. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    It's existed in some form for a while. A couple years back I was working on something to animate a character going down a slide, and I used an Animation Curve. I've also used one to define a character's jump height, and movement speed.

    But that project has vanished, so I can't help OP at the moment.
     
    dogzerx2 likes this.