|
edited: I'm completely re-wording the same question. Below, there's the original question. Now the title is pretty self explanatory and it's basically pointed towards iTween and Bob Berkebile: Can we mix both Path Controlled Character and Working With Physics at same time? The result should be something similar to what I did in my portfolio (in case the first link ever breaks, this second should have one updated) but except not using any hacks like I did and once it's applied to the character (like it is) it would be applied to every other rigidbody (yes, Lerpz is a rigidbody there). original:
(comments are locked)
|
|
I misinterpreted your question the first time. I think you want the following: The XY plane is now a curved surface, not on the groud, but the plane itself. You want objects to follow this curve. There are two good ways of doing this: take the curve data from a model, or take the data from a spline. If you are using a mesh, just create a single triangle strip in the shape of the curve, with the faces pointing towards the camera. Use the normal of the triangles in the strip to set the objects positions. Of course, the curve will need to have high resolutions or teh curve will look jagged as the characters move forward. You could interpolate the normals to get a smoother appearance of movement. if you use a spline, you'll need to know a little about splines first. http://www.unifycommunity.com/wiki/index.php?title=Interpolate is a good way to generate some catmull rom splines. From there, use the forward direction of any point you generate on the spline as the new forward direction of your character. You might want to squash the up vector of each of those points first. Yes, that is precisely the two ideas I've been trying. I actually started with a mix of both: http://www.unifycommunity.com/wiki/index.php?title=Spline_Controller But I was hoping for some completely different approach. Because the problem here is how to not affect the physics. On a 2D plane just setting the Z axis to zero works fine, but on this curved I'm still trying to figure it out. I just know it will need to both get the point direction AND adjust the position. To do so, I need to know how find out which "any" point to use. That's when I got stuck.
Jan 31 '10 at 03:59 PM
Cawas
Instead of parameterizing the object's position based on x and y coordinates, use the y coordinate and the ud coordiante. The ud coord is the distance in units travelled on the spline in the forward direction. To do this, the spline you have must be parameterized by distance since most splines do not trace equal distance for equal spline parameter. Search for arc-length parameterization for 3-d curves to get the jist of it.
Feb 01 '10 at 12:52 AM
Horsman
A functional way to build a arc-length parameterization is by integrating the distance along the curves in small chunks and them performing a lookup and using a bit of interpolation to make it smooth.
Feb 01 '10 at 12:52 AM
Horsman
I couldn't manage to use those Interpolation functions to solve this, and I'm no maths graduate to go too deep into that stuff... I don't want the curves or edges to have more weight (of dots) than the lines. They should be all equally distributed and the curves should be just a little bit smooth - so it won't disrupt the physics and it will look like it's linear. It's just a visual effect of deepness. Right now I'm trying to adapt the spline-controller to do that.
Mar 09 '10 at 08:05 PM
Cawas
(comments are locked)
|

Here's something that illustrates almost exactly what I needed back then, except picture it with physics for both player and objects. - Too bad I still couldn't find time to give it a shot: http://www.pixelplacement.com/itween/examples.php look for Path-constrained Characters.