I am trying to create lines in my project. I created a sandbox to learn how to do it.
LINE
I used the app.renderLine() to create a straight line, but:
I have to put the code in the method .update() otherwise I would not see any line.
It means that my line is being created every second?
I tried different types: LINEBATCH_WORLD, pc.LINEBATCH_OVERLAY, … but did not see any difference.
Am I doing right?
Can I change the width of the line?
CURVES
There is a pc.Curve But Is there any example?
I would like to make a curve between 2 points with different angles. I really did not understand how to do it.
Sorry, I am not used to it.
app.renderLine() is mostly for debugging purposes. The way I have done lines in 3D space before is to use a standard box or cylinder and position + scale it accordingly to change length and thickness.
Curves in 3D space is basically be lots of lines. There are ways of using pc.Curve to do so, here is a sample where we have a camera follow a spline path using the pc.Curve to deal with the interpolation between key points.
Drawing a curve would be similar except you would be drawing lines between interpolated points on the curve.
pc.Curve - is single value over time interpolation between keys. It has nothing to do with rendering.
renderLine - is simple debugging purpose feature. WebGL does not consistently provide different width of lines across all platforms. Most platforms support only 1px width.
To make lines - use procedural geometry. Read up in sources and around the places of how to generate procedural geometry.
Thanks for your reply.
I will try to create a curve line using your example.
As I am not used to geometry concepts … I believe it will be hard for me.
But I will try.