CameraSpline vs. SimPath
by Dusty Monk · in Torque 3D Professional · 03/02/2010 (4:12 pm) · 3 replies
So in my levels, I need to create an object and have it follow a preset spline curve path. I'm going to have a lot of these, so performance is a factor.
Because PathCamera already existed as a class, it served as a great template for me to get this functionality in game, and so I now have Shapebase derived objects with script interfaces that can follow a spline curve, provided by the CameraSpline class.
To create the paths, I create path's in the mission editor and fill them with markers. The marker's & paths though, were clearly originally designed to be used with SimPath's.. and this got me to thinking, maybe *I* should be using SimPath instead of CameraSpline. So I'm here asking for input from anyone that's had experience (or from the people that wrote them. :) ) about one over the other..
Some observations:
CameraSpline and SimPath create the knots for their spline curve using slightly different parameters. CameraSpline wants a "speed" value at each knot, whereas SimPath wants a "mstoNextWaypoint" value. While these values serve the same purpose, they go about it in slightly different ways, so you can't just arbitrarily use SimPath markers for the CameraSpline paths. I added the speed value to Marker just so I could use them without sabotaging MsToNextWaypoint.
They both appear to use create a catmull-rom spline curve, with the potential to specify a rotation about the tangent at any given knot. And at their heart, it appears both use the same polynomial functions. But this is only after a cursory observation.
And some questions:
1.) Are there any performance considerations for using the CameraSpline curve class over the SimPath class?
2.) Is there a developer "recommended practices" with regards to using one versus the other.
3.) Are there good resources for setting up and using a spline curve SimPath(and it's relationship with PathManager)? The only code I could find in the engine that made use of SimPath was PathedInterior, and the few places that looked like they evaluated the path along it's lenght by using PathManager -- had been commented out.
4.) Do we really need two spline curve classes in the code base? And if not and you guys consolodate the code around one class or the other, any recommendations on which one is more likely to be used in the future?
Thanks in advance,
Dusty Monk
Windstorm Studios
Because PathCamera already existed as a class, it served as a great template for me to get this functionality in game, and so I now have Shapebase derived objects with script interfaces that can follow a spline curve, provided by the CameraSpline class.
To create the paths, I create path's in the mission editor and fill them with markers. The marker's & paths though, were clearly originally designed to be used with SimPath's.. and this got me to thinking, maybe *I* should be using SimPath instead of CameraSpline. So I'm here asking for input from anyone that's had experience (or from the people that wrote them. :) ) about one over the other..
Some observations:
CameraSpline and SimPath create the knots for their spline curve using slightly different parameters. CameraSpline wants a "speed" value at each knot, whereas SimPath wants a "mstoNextWaypoint" value. While these values serve the same purpose, they go about it in slightly different ways, so you can't just arbitrarily use SimPath markers for the CameraSpline paths. I added the speed value to Marker just so I could use them without sabotaging MsToNextWaypoint.
They both appear to use create a catmull-rom spline curve, with the potential to specify a rotation about the tangent at any given knot. And at their heart, it appears both use the same polynomial functions. But this is only after a cursory observation.
And some questions:
1.) Are there any performance considerations for using the CameraSpline curve class over the SimPath class?
2.) Is there a developer "recommended practices" with regards to using one versus the other.
3.) Are there good resources for setting up and using a spline curve SimPath(and it's relationship with PathManager)? The only code I could find in the engine that made use of SimPath was PathedInterior, and the few places that looked like they evaluated the path along it's lenght by using PathManager -- had been commented out.
4.) Do we really need two spline curve classes in the code base? And if not and you guys consolodate the code around one class or the other, any recommendations on which one is more likely to be used in the future?
Thanks in advance,
Dusty Monk
Windstorm Studios
About the author
Dusty Monk is founder and president of Windstorm Studios, an independant game studio. Formerly a sr. programmer at Ensemble Studios, Dusty has worked on AAA titles such as Age of Empires II & III, and Halo Wars.
#2
Honnestly I don't know about CameraSpline classe, but I work a little with path and the MsToNextWaypoint is not used at all (or I didn't find where :D).
As a side effect, my shape is moving from node to node and did a stop before moving to next node even if MsToNextWaypoint =0.
If you succeed in working with your implementation, I will be pleased to have your feedback.
Now, to the question do we need 2 class, I would say no if we can merge the 2 in one class with both system (speed or time).
03/25/2010 (1:54 am)
Hi Dusty,Honnestly I don't know about CameraSpline classe, but I work a little with path and the MsToNextWaypoint is not used at all (or I didn't find where :D).
As a side effect, my shape is moving from node to node and did a stop before moving to next node even if MsToNextWaypoint =0.
If you succeed in working with your implementation, I will be pleased to have your feedback.
Now, to the question do we need 2 class, I would say no if we can merge the 2 in one class with both system (speed or time).
#3
I am making a cutscene editor of sorts and am struggling getting the timing to work correctly.
12/20/2011 (1:02 pm)
Hey Dusty or elvince. Did you ever figure out a proper way to use MSToNext or some way of setting the speed on each node so that it will take a specific amount of time to get to the next node?I am making a cutscene editor of sorts and am struggling getting the timing to work correctly.
Torque Owner Dusty Monk
Windstorm Studios
Thanks,
Dusty