Jump to content

spinning tube how to ?


onaid
 Share

Recommended Posts

hi again i am having some trouble getting a tube or cylinder to rotate using the motor lua see attached photo, i have also linked a map

 

guess what im trying to say is ihow can i get the tube/cylinder to rotate as one, not individual segments i want to put a path through the middle of the tube/cylinder

 

like walking thru the middle of a spinning tunnel if that makes sense ?

 

cheers

 

 

post-9540-0-20146100-1452223102_thumb.png

 

 

 

https://drive.google.com/folderview?id=0BxWM6ILP8Pf9dDBuczlqOFdEeGM&usp=sharing

Link to comment
Share on other sites

Here is an old tutorial that shows you how to rotate(turn) an object.

 

http://www.leadwerks.com/werkspace/page/tutorials_legacy/_/script/creating-your-first-object-script-r110

 

I'm not sure that the script is the cause of the problem thou. In your map your box rotates as expected. The problem seems to be with your tubes. I assume you have made them by carving a hole into a cylinder? This breaks your tube into multiple parts. So when you rotate it it breaks up.

 

Try and find a model of a cylinder and apply your motor script to it and see if that solves your problem.

Link to comment
Share on other sites

thanks for your help i used one by hollowing a cylinder and one by (create compound tube).

 

the box works cause it dose not have segments i think, unlike the tube,or cylinder with ends hollowed they have children so i attached the script to each individual segment so i guess they all rotate on a individual axis where as the box is only one piece rotating on common axis ?

 

but no matter which one the rotate in segments not as a whole .

 

i followed the tutorial and i can get the tube/cylinder to rotate in the right way but they still rotate individually.

 

this is the script i used below...again all segments rotate on there own axis not the tube/cylinder as a whole ?

 

https://drive.google.com/file/d/0BxWM6ILP8Pf9UjV2ZXFjTEx5M2M/view?usp=sharing

Link to comment
Share on other sites

thanks for your help , when i attach motor.lua or the script in the tutorial

https://drive.google.com/file/d/0BxWM6ILP8Pf9UjV2ZXFjTEx5M2M/view?usp=sharing

to only the parent and not the children nothing happens...... ( tube/cylinder dose not move )

only when i attach the script to each individual segment (child) will the object move, just not the way i want it to.

 

 

Do you have the script attached to each segment or just the parent cylinder? Because when you attach the script to each element, the behaviour of each element rotating is then correct. Can you also post a screenshot where all segments are rotated?

 

if you run the map i uploaded you will see how all the segments act individually, i can get the tube / cylinder to rotate but only like it was a orange in separate pieces

 

also tried saving as a prefab and it still keeps segments, and acts in the same manor.

Link to comment
Share on other sites

What's happening is the tube segments are being collapsed automatically to make the map render more efficiently. However, this causes a problem in this situation. One workaround is to create a blank script, select all the tube segments (just the children), and assign the blank script to the segments (all at once). This will prevent them from being collapsed and retain the tube hierarchy.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Works ok for me. These are the steps I performed:

1) Create Cylinder and perform Hollow operation.

2) Create Pivot and placed in center of the Cylinder

3) In Scene tab, select all of the Cylinder segments and drag to the Pivot to make them children

4) In Scene tab, select just the Pivot. Set the Physics properties (Collision=Prop,Mass=6). Add Motor.lua script and set options.

5) In Scene tab, select only the children Cylinder pieces. Add empty script.

6) Run game.

 

Note - do not add mass to the individual children Cylinder pieces or the cylinder will fall apart. Keep Mass = 0.

 

start.zip

  • Upvote 2

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Compound Primitives -> Tube

 

oh yeah - forgot all about the compound primitives. In that case the steps would be:

1) Create Tube.

2) In Scene tab, select just the Tube. Set the Physics properties (Collision=Prop,Mass=6). Add Motor.lua script and set options.

3) In Scene tab, select only the Tube segment children. Add empty script.

4) Run game.

 

Much easier.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

I think the idea could be applied to anything. When I hollowed csg to make a building and carved a door out they were all separate. Having them together would be nice.

 

Agree. It should behave like the compound primitives. The parent item should basically be like a pivot location with all of the remaining segments as children.

  • Upvote 2

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Thanks guys very much again smile.png works like a charm,

 

Works ok for me. These are the steps I performed:

1) Create Cylinder and perform Hollow operation.

2) Create Pivot and placed in center of the Cylinder

3) In Scene tab, select all of the Cylinder segments and drag to the Pivot to make them children

4) In Scene tab, select just the Pivot. Set the Physics properties (Collision=Prop,Mass=6). Add Motor.lua script and set options.

5) In Scene tab, select only the children Cylinder pieces. Add empty script.

6) Run game.

 

Note - do not add mass to the individual children Cylinder pieces or the cylinder will fall apart. Keep Mass = 0.

 

start.zip

 

Another example of multiple leadwerks users working together to solve one issue for an individual. This is what I love about the LE community.

 

true thatsmile.png cheers to everyone for your help

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...