Hi,
I am working on an educational game that allows museum visitors to explore various undersea environments. One of these environments is the undersea portion of an oil rig.
http://a5.sphotos.ak.fbcdn.net/hphotos-ak-snc4/58056_10150339222165467_431744650466_16137589_7115424_n.jpg
I have or can create models representing the various undersea well heads and components, and these are easy to place into a unity terrain, but I need to connect them to long pipelines that eventually lead up to the surface. I am trying to figure out the best way to do this. These are big heavy pipes, so they don't really need any physics to them. Colliders would be nice, but not absolutely necessary.
From my searches it seems like the best way to do this, may be a line or tube renderer:
http://www.unifycommunity.com/wiki/index.php?title=TubeRenderer
Unfortunately, both of these require very large arrays of vector3s which I can't find an easy way to create. I would like to be able to draw a smooth vector spline into 3d space, and render it either as a shaded, or preferably a dimensional tube, and be able to tweak positioning in unity.
The other way, I guess would be to make the pipes all in a 3d program and import them in as meshes. This might be better, but it would be hard to precisely connect them to the other models in unity, and have them lie along the bottom of the unity terrain.
Any suggestions?
Thanks,
-Matt
I'd go with the 3D modelling option. Just extrude a cylinder a whole lot, and give it bones with big, fat envelopes. Make the main bone be a short one on the bottom (the sea floor end,) where you want to bend them more, with longer ones near the top. No animation (or go ahead and make a few "swaying" clips.)
Twisting the bones (by hand, in SceneView/Inspector) will deform the object. I'm thinking if the bottom bone parents the rest, You can slap that right on your wellhead and tilt/animate the ones going up. They'll flap around at the top, but no one will be up there to see. If you want to hand-twist and animate, Additive animation mode might work.
You should be able to 3D model just one tube, and use different textures and scaling (in Unity) to reuse it for all the cables you need. If you need colliders, use the "compound" trick (one for each bone) and turn it into a prefab, to avoid the need to "collider up" each cable.
so heres a possible idea which might be somewhat labor intensive and or might not work
so in pipelines theres always that connection joint
now you should already have your basic pipe with texture that you can make as long as you want
but heres what i suggest
you make the large part of that joint
then you give it 2 children
these will be flat cylinders slightly wider than your pipes but smaller than its parent
and there length should be just long enough to hide any angles caused by this next step
next create a script
create an empty variable to assign your pipe to in the scene
then get the transform of that object
in the update
transform.LookAt(object);
-look at the scripting reference for a better description on how to do this
next put that script on the right cylinder then drag the pipe next to it into its variable slot then repeat for the left (DO not use colliders)
what you should be able to do at the end of this is
lay pipes in at whatever angle you choose
at the intersections of these pipes this joint should be placed
its children should be assigned to the corresponding pipes next to them
and their lengths should be just long enough to hide any angle caused by the connection
of course at the same time you could have just let the pipes intersect anyways since the player cant see the messy internal geometry, this just seems cleaner
but colliders will destroy it
If you're a somewhat experienced programmer and if you have to set up a lot of these pipes you could create an editor script that lets you do what you want - draw a spline in space and create it along the line. Actually, that's what is so fantastic in Unity, if you need to do something more then twice: write an editor script to do it for you.
To be honest it actually sounds like a fun challenge. If you'd like some help you can contact
me through the forums. ^.^