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
  Method of scattering objects along spline joebain 1 3 11-26-2024, 03:20 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 5 13 10-29-2024, 10: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: