Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help moving object aligned to spline by controls.
Hi, I had a question about controlling an object that is aligned to spline with the keyboard. Ive been looking into how to accellerate the object by modifying the speed float from the follow spline script but I get nothing at runtime. Im fairly new to unity and c# programming, so scripting is only basic knowledge, but I understand it for the most part, Ive been looking into the scripts you include in the addon, trying to figure out how to get it working. So far, Ive decided that I need to do alot more c# learning since it gets pretty complicated, but I tryed the help section and everything and still cant figure out how to move and object at a set speed, (e.g. h = input.getaxes("Vertical") * movespeed). I think im missing something.  Im basicly trying to have a centerpoint move with the spline and have another object rotatearound that point, so a tunnel shooter type game. Ive done alot of work so far, I just need to add the curving of the tunnels. Im sure this addon will do this for me since im terrible at mathematics. Ive also tryed using .moveby or whatever it is and cant get it working, wont even show in Mono. Not sure if I need to include a namespace like using or whatever. 

I was also wondering, once i get things working, if I can make a spline inside of tunnel peices and in the scripts, connect them together, instantiate maybe, and have the center point follow the spline and the connecting peices with the spline(a tunnel section prefab with a spline).

Love the addon, well worth it. cant wait to use it for other things, Unity really should include a spline or a way to do this without complcated coding. Ive tryed using blender to import splines, but none worked. This is the best solution ive found. So great work and hope you can help me out, thanks.



just create a custom controller and inherit it from FollowSpline, then apply your input value to the Speed parameter. See here for a general guide on custom controllers.

About the tunnels: You have prefabs and want them to align along the spline? Then you should try the SplinePathCloneBuilder, it may do exactly what you want.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Generate Mesh Spline from GameObject processor 4 161 10-01-2020, 11:00 AM
Last Post: _Aka_
  Generated mesh using bezier spline is not following the path accurately processor 3 270 08-25-2020, 04:39 PM
Last Post: _Aka_
  Best practice when Instantiating game object with spline GenericJoe 1 232 08-22-2020, 02:40 PM
Last Post: _Aka_
  How to calculate curvature of spline jh092 3 374 08-01-2020, 04:51 PM
Last Post: _Aka_

Forum Jump: