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
  How to get length starting from one spline to connected nth spline Dragon-3623 1 1 05-14-2024, 04:52 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_

Forum Jump: