Cable object

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Cable object // Interactive Artwork

1  |  

Post by ProfessorKhaos // Mar 5, 2007, 6:03pm

ProfessorKhaos
Total Posts: 622
pic
Hi all,


As some of you already know, I've been working on a "cable object" that draws a cable between 2 points, complete with the appropriate droop in the line.


This is a test version. It doesn't draw the rope mesh yet but does show how the cable would interact with moving end points. When the endpoints are extended beyond the length of the cable, it stretches to cover the distance. Any slack results in the characteristic droop of a hanging cable as shown below.


End points are shown as big boxes and 5 points on the cable are drawn at equal horizontal spacings between the two endpoints. Behind the scenes, 31 points are calculated from beginning to end so speed should hopefully be adequate provided the mesh generator itself can run quickly. Cable solver behind the scenes can go much higher than this for still frames or rendered animations too.


.rcd file below also works in truePlay (panel is shown automatically)


Rope mesh will obviously make this a far more interesting object. I intend rope to be UV mapped with an adjustable diameter and resolution around it's circumference.


Doing this in prior versions of trueSpace would have been very very tedious. Hope the end result is something all of you will be able to use whether or not you're a codehead like me. This is why I think the link editor gives us capabilities that will benefit many artists including those who don't script much or at all.


P.K.

Post by Wigand // Mar 5, 2007, 6:14pm

Wigand
Total Posts: 462
pic
In TruePlay I need an option to change the number of objects.

I only see 3 objects, so I don't see the shape of the cable.

Post by ProfessorKhaos // Mar 5, 2007, 6:18pm

ProfessorKhaos
Total Posts: 622
pic
Number of objects are fixed in this case. There's five in there plus the 2 endpoints. Some of the objects may be below the ground level if your cable is too long. Try playing with the settings for cable length. If you snug the cable up tight, you'll see all 5 objects almost in a straight line between the endpoints. Can you show a screen capture? Maybe I can help but I'm not quite sure of the circumstances you mention.


Not intending to up the number of objects linked in as it will be replaced by the rope mesh soon and the points won't be needed.

Post by Wigand // Mar 6, 2007, 6:05am

Wigand
Total Posts: 462
pic
When I open the scene in TruePlay and in Truespace, I can see only

Three objects. One of them is the light.

In LE, I actually 5 objects.


In TS I tried to move one cube, then the two disapear.

Post by ProfessorKhaos // Mar 6, 2007, 3:51pm

ProfessorKhaos
Total Posts: 622
pic
Anyone else with this issue? I can't seem to duplicate it. In trueSpace, this is what you should see inside the cable object. Dunno for sure but it may be possible that the solver brick or the demux boxes are mucked up somehow.

Post by kena // Mar 6, 2007, 5:02pm

kena
Total Posts: 2321
pic
wow - something I can answer with autority from the program. You have your icons set to "zoom to fit all"
click on the little icon next to the link editor name and select "iconize all"

Post by trueBlue // Mar 6, 2007, 5:33pm

trueBlue
Total Posts: 1761
pic
Looks and works fine here in truePlayer and trueSpace 7.11

Post by ProfessorKhaos // Mar 6, 2007, 7:33pm

ProfessorKhaos
Total Posts: 622
pic
Thanks Kena. You are indeed correct about the zoom :)


Alas, I probably wasn't communicating too clearly. :o The posted pics and message were in response to Wigand and because I couldn't fit all the bricks neatly in one screen I did a zoom to fit all to show the general layout. When I go back and read it again myself it does appear that the message was a new problem rather than a reference to a prior message. Shoulda said "anyone else with the above issue?" not "anyone else with this issue?"...


My concern was that the solver brick wasn't calculating correctly on his system for some reason or that the "demux xyz" bricks weren't passing on the right points out of the list. 30 segments means 31 points (from 0 - 30). The demux brick allows you to pick which of the 31 points you're forwarding xyz info to the cube matrices. I picked 5, 10, 15, 20, and 25 for the inbetween cubes. The end cubes are already present outside of the solver and match the 0 and 30th points output by the solver anyway.


Since Wigand's display wasn't showing the middle cubes I was curious what the internals of the script were displaying. Could be some initialization thing or subsequent installation side effect or maybe something else I've not thought of yet.


Your willingness to help is always appreciated though! :)

Post by Wigand // Mar 7, 2007, 9:41am

Wigand
Total Posts: 462
pic
Hello


It seems to be a localization problem.

Please check the string to number conversions.


you can change the last lines in your 'demux_xyz' into



params.conValue("outX") = parseFloat(listX[select]);

params.conValue("outY") = parseFloat(listY[select]);

params.conValue("outZ") = parseFloat(listZ[select]);

Post by ProfessorKhaos // Mar 7, 2007, 1:03pm

ProfessorKhaos
Total Posts: 622
pic
Hmmm... interesting observation. I assume this means commas are used instead of periods for your decimal points where you live.


Would have thought that localization issues would be symmetrical with regard to input/output between the solver script and the demux script. Both are written in jscript. Guess I was relying on implicit conversion to take care of things.


Something still strikes me as very odd about this case. The outX, outY, and outZ connectors are of type 'number' and they're properly displayed within the demux output brick even on your system. It's as if your system is designed to output periods for decimal points but ignore them for reading. Wonder if rosetta has some locale sensitive issues passing the number from one brick to another. Would have to know how the number is internally represented both in jscript and rosetta. Also, how the number would be represented inside the ExpandInMatrix code which appears precompiled.


Bizzare things sure do happen to computers when standards change across borders.


A good catch though and something to keep in mind when we troubleshoot future script issues.


P.K.

Post by trueBlue // Mar 7, 2007, 5:10pm

trueBlue
Total Posts: 1761
pic
Hey P.K. major bit of scripting going on here. As mentioned previously I'll set back and watch and hopefully learn something in the process. I appreciate you sharing your process along the way. One thing that I noticed is that you have Expanded the Matrix of the end cubes and so you are limited to using the panel that you have supplied to interact with it. Not sure if this was intended or not but I disconnected the wire from the Matrix and hooked it up to the OwnerMatrix on each of the end cubes. So now you can select them in 3D Space and move them around with one's mouse.
Have you tried Physics on this example yet?

Post by ProfessorKhaos // Mar 7, 2007, 9:54pm

ProfessorKhaos
Total Posts: 622
pic
Haven't worked on a trueSpace physics based solution as of yet.


Got a new version to try. Spent the better part of a nice sunny afternoon making a rope mesh creator. Still have to figure out how to add the UV stream to the mesh (think I managed to avoid most of that issue when making the LED displays by directly manipulating material indices instead).


This one is more usable in the sense I think most folks would want to attempt.


Not sure about the locale issue mentioned above and this version. It may work, it may not. As always, comments and crits welcome.


Code needs a bit of cleanup work as there's a few trial and error aspects to it as well as some unnecessary troubleshooting code going on.


P.K.

Post by ProfessorKhaos // Mar 8, 2007, 5:01am

ProfessorKhaos
Total Posts: 622
pic
Another issue I need to check into are the mesh normals(?). I think that may be in part why I'm getting the weird shading at the segment joints in the cable mesh. Could be the directX shader I'm using but I have to experiment to find out.

Post by Wigand // Mar 8, 2007, 5:54am

Wigand
Total Posts: 462
pic
looks good and works fine :)

Post by Délé // Mar 8, 2007, 7:16am

Délé
Total Posts: 1374
pic
This is very cool PK! :) :banana: This could be quite useful. You could make cables on a procedurally animated machine that would move properly as the machines parts move. The only suggestion I have (which you've probably already thought of) is to have a checkbox to hide or reveal the end handles.

Post by ProfessorKhaos // Mar 8, 2007, 4:21pm

ProfessorKhaos
Total Posts: 622
pic
Thanks Délé


Good thing about the end handles are that they're actually not a part of the cable object but are external objects in this example. They can be any object or set of coordinates provided to the object in the form of two "anchor" matrices. In this particular case I've created two cubes and used their position to define the cable endpoints, but in theory it could be script driven or linked to a null or hidden object easily.


Vray based test animation showing cable in motion below...


P.K.

Post by ProfessorKhaos // Mar 18, 2007, 8:08am

ProfessorKhaos
Total Posts: 622
pic
Howdy folks,


For those who are interested, I've been working a bit more on mesh creation techniques and have confirmed that the odd shading to the segments is related to a lack of normals assignments.


Fix for the cable is a bit far off for now but I'll revisit the topic when I'm ready to move forward. You should see UV mapping occur about the same time which means you'll be able to add a rope texture to the object eventually.


About the same time I'll be putting together a simple tutorial on how to make a mesh for a cube, to include vertex, triangle, face, normals, and UV map definitions.

Post by ProfessorKhaos // May 11, 2007, 3:50am

ProfessorKhaos
Total Posts: 622
pic
The normals issue that gave my cable object an odd segmented appearance has been resolved thanks to Tomas. The solution is unique to tS 7.5 so you'll need the upgrade for the new version to work. No downloads to supply here because you'll have it in the Objects - Base library the moment you install 7.5 ;)


If you use the LE to browse inside the encapsulated cable object, you'll see a few more controls that allow you to adjust cable thickness, length, mesh detail, and UV mapping.


The encapsulation was provided for convenience to show how the cable works with other objects while supplying as a single RsObj for the library. You can very easily extract and use the Cable Object brick within the encapsulated cable object to rig the cable up to a variety of other items.


If anyone has any questions on how to use these objects just ask and I'll be happy to explain.


Just a final note. Any coding mistakes in the cable object are my own. Caligari has forwarded the object to you "as is".

Post by Norm // May 11, 2007, 4:55am

Norm
Total Posts: 862
pic
And what a very cool object it is :banana:

Post by prodigy // May 12, 2007, 10:54am

prodigy
Total Posts: 3029
pic
Very very nice object PK... Very nice work..

Now i can make a bridge :D

Post by Steinie // May 12, 2007, 4:36pm

Steinie
Total Posts: 3667
pic
No it's upside down to make the St. Louis Arch:cool:

Post by kena // May 12, 2007, 6:06pm

kena
Total Posts: 2321
pic
If anyone has any questions on how to use these objects just ask and I'll be happy to explain.
<Raises hand>
It looks like this would be perfect to construct something like a rope bridge...
Is there a way to do that?
Could you construct a tutorial for that?
And maybe explain why I cannot see it in the model window?

Post by ProfessorKhaos // May 12, 2007, 7:01pm

ProfessorKhaos
Total Posts: 622
pic
<Raises hand>

It looks like this would be perfect to construct something like a rope bridge...

Is there a way to do that?

Could you construct a tutorial for that?

And maybe explain why I cannot see it in the model window?


Hmmm... looks like the way I encapsulated it (not in 3D) is the reason why the model side doesn't know about it. Actually, while in the model side if you render the screen using Vray you'll see the object in the render.


There is an easy solution, and what's more it's what you would have done anyway to use this object in your own projects.


Steps:


1. Start a new scene

2. Drag the "encapsulated cable example" object onto the 3D window

3. Open a LE window (if not already open)

4. Enter the 'encapsulated cable example' brick by clicking on the orange square in the upper right corner


At this point you'll see 3 bricks within the encapsulated cable example you just entered. These will be cube, cube1, and Cable Object.


5. Click once on the 'Cable Object' brick to select it. The tabs for 'Exp' and 'Default' should be present right under the title bar if it is selected.

6. Right click on the background of one of your object libraries in the stack and select 'insert'


At this point you will now have the cable object available in your library for direct use in your projects.


Now, we're going to have a little fun.


1. Start a new scene

2. Drag the newly inserted cable object from your library to the 3D window. The cable appears. (Switching to model view shows the object there as well...)

3. Open the LE (if not already open)

4. Select the cable object. Make sure the 'default' aspect tab is active.

5. Right click over the Anchor #1 Matrix entry and select 'expand'

6. Type in new 'tx','ty','tz' coordinates for the x,y,z location of the near cable end

7. Right click over the Anchor #2 matrix entry and select 'expand'

8. In the ExpandinMatrix box that appears, type in new 'tx','ty','tz' coodinates in for the x,y,z, location of the far cable end.

9. Adjust cable length, thickness, segments, etc as desired.


If you'd rather the cable ends be attached to object locations, you can easily accomplish this by connecting the wldmatrix output of the object to the anchor #x Matrix of the cable object in the LE. This can even be done temporarily with "Marker objects" such that common tie points are all located together correctly.


Maybe a bridge tutorial would be a good idea. I'll put one together.


For the mathematically inclined, a rope drooping under it's own weight follows a catenary curve such as the one above. A foot bridge would fall in this category. Some suspension bridges (those with flat walking decks) usually have a parabolic main cable shape instead due to weight distribution. They look pretty close though so unless you're trying to impress a bunch of architects, you'll probably be pretty close to the mark.

Post by ed_baker // May 14, 2007, 2:48am

ed_baker
Total Posts: 355
pic
Is there a way to make the cable interact with the physics?


Playing with it a little and can't seem to get it to do anything.


By the way this is really fantastic. Plays right into an animation idea I have, except I need it to react to other objects. Kind of like a cloth or soft body object.


Ed

Post by ProfessorKhaos // May 14, 2007, 3:49pm

ProfessorKhaos
Total Posts: 622
pic
This version only solves the steady state case for a hanging rope given two anchor points and a length. The solution can update in realtime but it doesn't respond to collisions from other objects. Other objects will bounce off the cable but won't cause it to start swinging. Steady state implies that the solution is what you would see once the anchor points have remained in place and the rope swing has dampened out.


I've designed some of the internals of the object for reuse and my hopes are that one day soon I will be able to create a version that will react to collisions with other objects.


Areas where I think this would animate well would be in hydraulic hoses on equipment and such. Maybe a drawbridge lowering. Slider for UV offset allows for illusion of continuously moving cable if sawtoothed from 0 to 1 repeatedly.


I've made some attempts at a more dynamic object that would swing around with upsets in the anchor point positions but have had a few numerical stability issues with my own script. I'd like to integrate this with the physics engine but that will take a bit more research on my behalf.


I hope to create a pulley rig using the mesh generator brick within the cable object in the near future. This would be a relatively easy project I should think.


Glen

Post by ed_baker // May 15, 2007, 1:46am

ed_baker
Total Posts: 355
pic
This version only solves the steady state case for a hanging rope given two anchor points and a length. The solution can update in realtime but it doesn't respond to collisions from other objects. Other objects will bounce off the cable but won't cause it to start swinging. Steady state implies that the solution is what you would see once the anchor points have remained in place and the rope swing has dampened out.


I've designed some of the internals of the object for reuse and my hopes are that one day soon I will be able to create a version that will react to collisions with other objects.


Areas where I think this would animate well would be in hydraulic hoses on equipment and such. Maybe a drawbridge lowering. Slider for UV offset allows for illusion of continuously moving cable if sawtoothed from 0 to 1 repeatedly.


I've made some attempts at a more dynamic object that would swing around with upsets in the anchor point positions but have had a few numerical stability issues with my own script. I'd like to integrate this with the physics engine but that will take a bit more research on my behalf.


I hope to create a pulley rig using the mesh generator brick within the cable object in the near future. This would be a relatively easy project I should think.


Glen


The pulley idea sounds excellent. Sad that it isn't affected by other objects. Not being much of a programmer, and having even less time, that really stinks for me. I look forward to using this object anyway.


Please keep us posted on any extra functionality you are able to put into it.


Thanks,

Ed

Post by kena // May 15, 2007, 5:15pm

kena
Total Posts: 2321
pic
Thank you Prof.. that is exactly what I was looking for... now to see if I can make a nice rope bridge... hope I'm up to it. :D

Post by trueBlue // Dec 15, 2008, 7:31am

trueBlue
Total Posts: 1761
pic
Hmmm... looks like the way I encapsulated it (not in 3D) is the reason why the model side doesn't know about it. Actually, while in the model side if you render the screen using Vray you'll see the object in the render.

There is an easy solution, and what's more it's what you would have done anyway to use this object in your own projects.

Steps:

1. Start a new scene
2. Drag the "encapsulated cable example" object onto the 3D window
3. Open a LE window (if not already open)
4. Enter the 'encapsulated cable example' brick by clicking on the orange square in the upper right corner

At this point you'll see 3 bricks within the encapsulated cable example you just entered. These will be cube, cube1, and Cable Object.

5. Click once on the 'Cable Object' brick to select it. The tabs for 'Exp' and 'Default' should be present right under the title bar if it is selected.
6. Right click on the background of one of your object libraries in the stack and select 'insert'

At this point you will now have the cable object available in your library for direct use in your projects.

Now, we're going to have a little fun.

1. Start a new scene
2. Drag the newly inserted cable object from your library to the 3D window. The cable appears. (Switching to model view shows the object there as well...)
3. Open the LE (if not already open)
4. Select the cable object. Make sure the 'default' aspect tab is active.
5. Right click over the Anchor #1 Matrix entry and select 'expand'
6. Type in new 'tx','ty','tz' coordinates for the x,y,z location of the near cable end
7. Right click over the Anchor #2 matrix entry and select 'expand'
8. In the ExpandinMatrix box that appears, type in new 'tx','ty','tz' coodinates in for the x,y,z, location of the far cable end.
9. Adjust cable length, thickness, segments, etc as desired.

If you'd rather the cable ends be attached to object locations, you can easily accomplish this by connecting the wldmatrix output of the object to the anchor #x Matrix of the cable object in the LE. This can even be done temporarily with "Marker objects" such that common tie points are all located together correctly.

Maybe a bridge tutorial would be a good idea. I'll put one together.

For the mathematically inclined, a rope drooping under it's own weight follows a catenary curve such as the one above. A foot bridge would fall in this category. Some suspension bridges (those with flat walking decks) usually have a parabolic main cable shape instead due to weight distribution. They look pretty close though so unless you're trying to impress a bunch of architects, you'll probably be pretty close to the mark.
Looks like there is an easier way to show the Cable Object in Model.
1.) 3D Encapsulate it, but then you would have to export and create the UI again.
2.) Import a Transform object inside the Cable Object and hook up it's WldMatrix to all three of the Objects OwnerMatrix. Which is what I have done here:
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn