Once you have capsules available, you can make all sorts of stringy objects.
Here are some helices formed out of spheres. Your job is to make these helices
out of capsules instead. Stringing together the capsules can be a little tricky,
as you want to get the end conditions correct. Where two capsules touch, you
want to generate only one sphere, not both. This saves on memory and increases
performance. That said, you want to make sure that both ends of the helix have
spheres on them. As a bonus challenge, try not to compute both points for each
capsule on each loop iteration. It's more efficient if on each iteration you
compute just one of the points. When you're done, the capsules should look like
this. There's a parameter in the code called radial segments that you can
increase to give a smoother result than shown here.
カプセルが準備できたら
多種多様なひも状のオブジェクトが作れます
このらせんは球体から作られています
皆さんはカプセルから同じものを作ってください
端部をうまく処理してカプセルをつなぐのは
難しいかもしれません
2つのカプセルが接する部分には
球体を2つではなく1つだけ生成します
そうすればメモリを節約でき
パフォーマンスも向上します
ただし必ずらせんの両端を球体で覆ってください
チャレンジ問題としてカプセルの両端の位置を
それぞれのループで計算しないでください
両端のどちらか一方の位置のみ
計算する方が効率的です
完成するとこのようになります
コードのradialSegmentsというパラメータで
今表示されているものより
なめらかな仕上がりにできます