Jump to content

Cables/Wires in Editor


Michael Betke
 Share

Recommended Posts

I need someone who can do a .lua based solution to place cables or wires in the editor.

This function is needed in for a project I'm working on. I need to do lots of power-cables and can't do them in 3dmax because of the irregular and modular layout of the project.

 

Maybe someone can do something which uses the road system and I can place "cable_nodes".

The wire which needs to be places should be 3-sided and have the ability of adding a material to my cable/wires.

It's no need to have them physical interacting.

 

Is it possible? What would it cost? If someone will do it for free and offer the community I would donate of course. ;)

 

I need this done in approximatly two weeks.

Pure3d Visualizations Germany - digital essences

AAA 3D Model Shop specialized on nature and environments

Link to comment
Share on other sites

Ok, Michael. I'll give it a go.

Have to start doing things with LUA anyway sooner or later.

 

It will cost you... a couple of 3d trees. But since you already gave some of those to the community earlier I'll let you off the hook this time.

desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP

laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32

Link to comment
Share on other sites

Here's what I've got so far:

http://cocopino.eu/download/Cable.zip

 

(unpack in your LESDK/models folder)

 

Obvious problems are that the cables are gone when saving & loading the scene and that the texture shouldn't scale.

 

Does anybody know if there's a LUA function that is triggered when loading/dragging an instance of an object into the scene? I would guess "Spawn" but this doesn't do anything for me.

desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP

laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32

Link to comment
Share on other sites

Hi Michael,

 

I changed the name of the node mesh so there can be no confusion going on name-wise.

 

Here's how it works:

 

When dragging a node onto your scene, the editor will give it a name like cablenode_3. If there is another cablenode present in the scene, having an index number of 1 digit lower (in this case cablenode_2), the lua script will load a mesh (cables_mesh.gmf) between those two nodes and then scale it.

 

You can use any mesh you like for this, but it has to be exactly 1 Leadwerks unit long in z-direction. The nodes can be made visible/invisible by changing the material to cablenode_diffuse.mat/cablenode_invisible.mat.

 

The thickness of the cables can be changed by changing the property "Thickness". The material of the cables can be changed by changing the property "Material File". Note however that scaling the material may make the texture look bad. I'm hoping for a positive answer on my question about this in another thread to change that.

 

Is this more or less what you're looking for?

Cable.zip

desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP

laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32

Link to comment
Share on other sites

I tried your first cable download. I'm out at the moment so I cant try your lates version now.

 

One important thing is some kind of iteration to the model. Like a spline.

 

For example:

I want to connect a house with my electricity pole. So I need two points. A and B.

If I connect them I would get a straight line. But a wire is hanging a bit.

To solve this I would need to place lots of nodes and place allign them each. This would take a lot of time.

 

I would prefer to place the two nodes A and B, open properties, define the number of sides, and a "hanging" value to define the bend value of my wire. A "bend shift" to have the lowest point a bit more left or right would be the ultimate bonus. I think this would be the best wire/cable feature for most peoples needs. :)

 

But like I said. I have no idea if it's possible.

Pure3d Visualizations Germany - digital essences

AAA 3D Model Shop specialized on nature and environments

Link to comment
Share on other sites

Something like this?

 

untitled-1.jpg

 

untitled2.jpg

 

Not done is LUA but in C++, its got a lot of work to make it perfect mind you but I could work on it and pass it onto another forum member to implement into LUA when its done.

AMD Athlon 64 X2 Dual Core 6000+ (3.0 GHz)

4 GB DDR2 RAM

2 x NVIDIA GeForce 9500 GT 512 MB (SLI 1.0 GB)

Windows XP Pro

Link to comment
Share on other sites

This weekend I'll probably have my LUA implementation done; It has a lowest Y value and a lowest segment value so you can make it bend realistically when one of the nodes is higher placed up than the other.

 

Wouldn't mind looking at your code though MasteR.

desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP

laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32

Link to comment
Share on other sites

you are both welcome to the code here.

 

cocopino if you could combine this with your LUA node implementation then I'm sure you'll make the community very happy.

AMD Athlon 64 X2 Dual Core 6000+ (3.0 GHz)

4 GB DDR2 RAM

2 x NVIDIA GeForce 9500 GT 512 MB (SLI 1.0 GB)

Windows XP Pro

Link to comment
Share on other sites

I purposely don't use physics at all in my solution, because Michael stated he didn't need it, and it will most likely mean more calculations for the engine.

I'm going to pursue that as well so both physics/non physics solutions will be available.

 

Cool huh Michael?

desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP

laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32

Link to comment
Share on other sites

Its cool. Ar the Moment im in holidays and Typung from my mobile. Will check back in à Fee days Guss but it Looks awesome. Never thought of lua beeing so powerful!

Enjoy and have another beer! :mellow:

desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP

laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32

Link to comment
Share on other sites

Ok, another version here, not really polished but it should be workable.

The code has become a bit of a mess, a lot of optimization can be done there. But as soon as you stop dragging nodes around, there won't be any impact on FPS (apart from the few polygons that are added to the scene of course)

 

Cable.zip

desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP

laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32

Link to comment
Share on other sites

I checked the cable and it works very good so far. :lol:

 

There are also some flaws with the node. If I move or delete a ode it seems I get two wires for some reason.

If I delete two nodes the wire is still present in the editor.

 

Do I have to set up both nodes in the same way, or is one node enough?

I assume if I export a thinner model the value for thickness will make more sense?

Pure3d Visualizations Germany - digital essences

AAA 3D Model Shop specialized on nature and environments

Link to comment
Share on other sites

I see now I didn't test this very well, sorry.

 

- If I delete two nodes the wire is still present in the editor.

Yes, the wires are not freed at first (they are when saving and reloading the scene)

 

- Do I have to set up both nodes in the same way, or is one node enough?

There's always two nodes needed to create a line, and they need to have an incremented number, e.g.: cablenode_3 + cablenode_4 will create a line between those two.

 

- I assume if I export a thinner model the value for thickness will make more sense?

The thickness is nothing more than a multiplier, I can also make the multiplier go below 1 to make the cable less thick.

 

One thing I didn't test at all is that the values you type in are values for all nodes/cables. This wasn't what I wanted, I'd like to be able to give all cables different values. So still WIP!

desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP

laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32

Link to comment
Share on other sites

The thickness is nothing more than a multiplier, I can also make the multiplier go below 1 to make the cable less thick.

This would be very helpfully!

 

- Do I have to set up both nodes in the same way, or is one node enough?

There's always two nodes needed to create a line, and they need to have an incremented number, e.g.: cablenode_3 + cablenode_4 will create a line between those two.

 

I was refering to the values. Like I place two nodes and enter my settings in the first of the two nodes.

Or do I have to place, write values to node1, then go to node2 and enter the same values to make it working properly.

Pure3d Visualizations Germany - digital essences

AAA 3D Model Shop specialized on nature and environments

Link to comment
Share on other sites

New version again Michael, we'll get there eventually! (I hope :) )

 

It still needs two nodes with incremented numbers, eg: cablenode_3 + cablenode_4

When changing node values, these values will apply to all nodes that haven't been set yet. So you have to set the values only once, but you still have control over all cables.

Non-used segments will be removed when changing "Number of Segments" to a lower number.

Thickness can be 0.1 now.

 

Cable.zip

desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP

laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32

Link to comment
Share on other sites

  • 1 month later...

ahh noticed some other errors.

 

1. There is a stair effect on my old cables. I have to press around 3-5 times "Apply" before something happens and the effect is gone.

 

post-6-010758300 1285594264_thumb.jpg

 

 

 

2. Depending on the bending of the cable there is an obvious disconnected effect of each element.

post-6-057062500 1285594265_thumb.jpg

Pure3d Visualizations Germany - digital essences

AAA 3D Model Shop specialized on nature and environments

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...