Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help moving object aligned to spline by controls.
#1
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.

 
 

 
Reply
#2
Hi,

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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 1 1 2 hours ago
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 2 2 hours ago
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_
  GO can't fit end of the spline GameDeveloperek4123 3 13 03-04-2024, 11:06 AM
Last Post: _Aka_

Forum Jump: