Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Freely move on spline
#1
Hello,

I've just bought the Curvy plugin and it's really impressive, especially the way to do an endless runner which is what I'm working on.

But I'd like to know if there would be a way to use Curvy to make a racer using splines as roads, and so to move freely on it and not being restrained on a line ?

Thanks and keep up the good work.

F.
Reply
#2
Hi Jedibald,

thanks for supporting us!

(10-08-2013, 12:39 PM)jedibald Wrote: But I'd like to know if there would be a way to use Curvy to make a racer using splines as roads, and so to move freely on it and not being restrained on a line ?
There are several ways I can think of. The best way highly depends on your scenario:

* If you need physics, you're bound to colliders. So you'll need to use the road mesh (generated e.g. by the SplineMeshBuilder) as a mesh collider and rely on physics only.

* If you only want to move left or right (shooter style), the axis to strafe on can be found by using the spline's orientation and tangent (see CurvySplineBase.GetExtrusionPoint). For example, if you're road is 4 units wide, GetExtrusionPoint(myTFPosition, 2, 90) gives you the rightmost point of your road (angle of 270 or better "currentPos-Rightmost" gives you the leftmost point). On Left/Right, just move the car between the leftmost and rightmost position.

Hope that helps

Jake
Reply
#3
Hi,

Thanks you for your answer.

In fact I had already tried the first way, I added a mesh collider to my road mesh, its mesh property being assigned to the road mesh.

But as I tried to test it, first it didn't recognize the collider as my player with sphere collider and rigid body passed through it, and when I was back to the project, the mesh property was back to 'None (Mesh)', And I couldn't assign the mesh anymore. Is it a normal behavior as I've never experienced it with other mesh colliders.

Hope you can help.

Thanks.

Jedibald.
Reply
#4
The mesh will be recreated when the initializes or when the spline changes. You want to detach the mesh from the MeshBuilder, then it becomes a "regular" static mesh object.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  How to spawn GameObjects on corners of the liinear spline? Pixel Flipper 7 86 09-18-2019, 07:03 PM
Last Post: _Aka_
  Best practice for mass-object instancing along 100km spline (railways) plus streaming bs@vectorvision.de 8 140 09-18-2019, 06:48 PM
Last Post: _Aka_
  How to properly set UV for extruded spline texture Pixel Flipper 3 84 09-05-2019, 11:55 AM
Last Post: _Aka_
  Steer Towards Spline whitecastleroad 3 94 09-04-2019, 01:39 PM
Last Post: _Aka_

Forum Jump: