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
  Moving Platform Kokoriko49 8 19 09-23-2024, 09:20 AM
Last Post: _Aka_
  Bug: Save Generator Outputs still saves outputs if object is disabled curvymesher 1 3 08-30-2024, 09:19 AM
Last Post: _Aka_
  Player move with object mcarman 4 8 07-29-2024, 06:49 PM
Last Post: mcarman
  Nested Spline Volume Spot Instantiation merobbins5 3 7 07-26-2024, 09:58 AM
Last Post: _Aka_

Forum Jump: