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
  player stuck on spline Dextex 4 116 07-17-2021, 04:52 PM
Last Post: _Aka_
  Locking the UV's of a closed spline John_MLS 1 118 07-09-2021, 03:54 PM
Last Post: _Aka_
  Accessing generator's input spline in script, changing it at runtime smackledorf 3 301 06-17-2021, 01:59 PM
Last Post: _Aka_
  Questions about Generator: mesh/objects within spline, snap to control point dartboard 5 470 06-09-2021, 12:42 PM
Last Post: _Aka_

Forum Jump: