Right now I’m preparing conceptual code for my game to shape broad based concepts and grasp the mechanics of Panda. There’s a feature which I would like to implement that allows a player to draw a curve (and linear) path in the 3d space and a roadway will then be drawn along the defined path. Think of Sketchup’s Line and Arc drawer with the Follow Me Tool.
Do anyone of you know where I should start? How would one represent this feature in high level “pseudo” code? I’m really open to points in the right direction and tutorial links if any.
First you have to have some thing solid to draw one like a plane. Then just capture collision positions and put them into a list. You probably capture way more collision then you need just through out a collision if it has not changed much from the last one.
What I’m aiming for is to draw a curve pathway along the surface of the terrain. The user will place a starting node and a curve will be drawn in 3d space (along the terrain) and the user must place a second node to complete the curve (arc).
After the second node is place a modeled cross section of the pathway will be extruded from the first point along that curve while finishing at the last created node.
I really appreciate your interests. Happy New Year.
you dont need arc and that other stuff just use the
CurveFitter:
cf = CurveFitter()
unitsPerPoint = float(len(units))/len(self.targets)
t = 0
for point in self.targets:
cf.addXyz(t,point)
t += unitsPerPoint
nurbs = cf.makeNurbs()
for i,unit in enumerate(units):
pos = Vec3(0,0,0)
nurbs.evaluateXyz(i,pos)
self.pickedPos[unit.id] = pos
^ This is how use it, i don’t know if it helps.
* collect N points (using collision)
* use CurveFitter to generate M points for drawing
* draw the Curve
CurveFitter is not a shape, its a math thing - points in points out. But yes after you construct your curve you can pick at want resolution you want your road to be and draw triangles based on the data from the curve fitter.