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
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_
  Keeping a fixed spline length jh092 3 16 02-21-2024, 06:25 AM
Last Post: Primrose44
  How could I get position in spline from "From" value in BuildRasterizedPath? Chanon 1 8 02-12-2024, 09:54 PM
Last Post: _Aka_

Forum Jump: