Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Collision along spline
#4
Okay, so I might need a little more help, and I suppose my situation requires some more explanation.

What I'm attempting to set up is a 2.5D Sidescroller controller which travels along a Curvy spline.  Like a sidescroller, the character can move only forwards and backwards, however, unlike traditional sidescrollers, this movement isn't simply restricted to two axes, but is rather constrained along a spline.  At least, that was the theory.  The camera moves along its own spline, and it travels along its spline relative to the player's position on his spline. (If that made any sense whatsoever.)

I've almost got it set up perfectly - it was easy enough to remove the restriction on the Y axis to allow the player to jump, and the camera is set up correctly.  Pressing forwards sets the followspline script's speed forwards, backwards backwards.

The only problem is, as I stated earlier, collisions don't seem to work along the spline.  The player can hit things above or below him, since that movement isn't handled by the Followspline script, but anything else the player just goes through.  I set up something of a solution by creating an onCollisionEnter flag, but rubbing against things feels glitchy, with the player twitching back and forward.  What I need is for the player simply to be stopped, the way he would be if it was a simpler 2D controller.

The trouble is, I don't understand why I'm able to phase through objects at all.  As far as I can tell, what I'm doing isn't much different from a simple transform.Translate() - the only difference is that the FollowSpline tracks the player's TF and CurrentSegment.  Sure, there's some fancy calculations in getting the target translation, but other than that...?
Reply


Messages In This Thread
Collision along spline - by Keladinus - 08-05-2014, 06:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  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_
  GO can't fit end of the spline GameDeveloperek4123 3 14 03-04-2024, 11:06 AM
Last Post: _Aka_

Forum Jump: