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
  Spline object on a spline path ATHellboy 15 322 Yesterday, 12:17 AM
Last Post: _Aka_
  Convert position of a point on a spline to another spline which is connected ATHellboy 5 106 02-17-2020, 12:17 PM
Last Post: _Aka_
  Moving freely on the Y axis? clearleaf 6 1,193 01-30-2020, 11:21 AM
Last Post: ATHellboy
  Refresh spline doesn't seem to be working dazz777 6 682 01-22-2020, 12:55 AM
Last Post: _Aka_

Forum Jump: