0

For my 3D game about a spaceship flying in a cave, I need to modify the geometries that the cave is built from. As stated in earlier posts, the cave is constructed from circular shapes by putting one shape behind another to create a tube-like surrounding, in which the ship is maneuvering. The shapes are tilted in small angles so the tube is curved. However, the tilting of the shapes creates overlapping parts that disturb the tube's appearance. Thus, the geometries of the shapes need to be adjusted - shorter in the inside of the curves and longer on the outside.

At first I thought that a 'vertex shader' could be the solution, but I learnt from a previous post that this describes something else: an algorithm modifying the visual appearance of the shape, but not creating a modified geometry that could be used i.e. as a physicsBody (which is required for correct collision detection). So now I am seeking help in the dynamic modification of SCNgeometries. At this point in time, I have never programmed anything alike, but if I understand correctly, I need to read and modify the vertices of the geometry.

2 rings each containing 12 rectangles - to be modified

There is one more thing to mention: the rings themselves are not a one-piece, but made from a number of plane segments, so the routine would need to (internally) create the higher-order structure (the ring) first, before it is applied on the same. On the attached picture, you can see the 2 rings (from outside). Can anyone share an (as simple as possible) description or a link, where I could find the information I am looking for?

(I positioned the rings for better clarity - they are not in the correct position for simple merging)

ULI
  • 41
  • 7
  • For such stuff, I really recommend you to build your tube like in Blender or whatever external program. Putting the tube together using scene nodes for each segment will quickly push Scenekit to its limits. – ZAY Aug 30 '23 at 20:36
  • Ok, assuming I do this - using a ring I created earlier in blender - how to I modify the single vertices? – ULI Aug 31 '23 at 15:54
  • do you mean modifying using scenekit or blender? What I mean: create the whole tube in blender. it can be very long and curvy. assign static concavePolyhedron physics body, and you will be able to move a dynamic physics node inside it. (and put the normals inside the tube, and make the visual rendering eventually double sided) – ZAY Aug 31 '23 at 19:33
  • 1
    I haven‘t thought that far. I think the compromise could be the solution: the ring is created with blender, and a number of these is used to make the tube (with a concavePolyhedron for each ring). And I already have an editor for the caves, with functional tunnel parts, enemies, etc. All this is working, only working with the tunnel-made-of-rings principle. – ULI Sep 01 '23 at 11:10

0 Answers0