onaid Posted January 8, 2016 Share Posted January 8, 2016 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 https://drive.google.com/folderview?id=0BxWM6ILP8Pf9dDBuczlqOFdEeGM&usp=sharing Quote Link to comment Share on other sites More sharing options...
Angelwolf Posted January 8, 2016 Share Posted January 8, 2016 function Script:UpdateWorld() self.entity:Turn(0,0,1) end You could try that instead of the motor script. Taken from the tutorial page. Quote My Games: Nightmare Prism:::WolfTale:::Dungeon Creeper:::Despair of Ordinary Men:::Piano Simulator 2016:::House (W.I.P) Link to comment Share on other sites More sharing options...
onaid Posted January 8, 2016 Author Share Posted January 8, 2016 function Script:UpdateWorld() self.entity:Turn(0,0,1) end do i create a new script with the above or add it to motor.lua ? thanks Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted January 8, 2016 Share Posted January 8, 2016 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. Quote Link to comment Share on other sites More sharing options...
onaid Posted January 8, 2016 Author Share Posted January 8, 2016 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 Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 8, 2016 Share Posted January 8, 2016 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? Quote Link to comment Share on other sites More sharing options...
Rick Posted January 8, 2016 Share Posted January 8, 2016 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 ? Don't do that, as Aggror says, just do it on the top level. Quote Link to comment Share on other sites More sharing options...
Angelwolf Posted January 8, 2016 Share Posted January 8, 2016 I think another option is to save the tube as prefab and reimport as one item,. Quote My Games: Nightmare Prism:::WolfTale:::Dungeon Creeper:::Despair of Ordinary Men:::Piano Simulator 2016:::House (W.I.P) Link to comment Share on other sites More sharing options...
onaid Posted January 9, 2016 Author Share Posted January 9, 2016 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. Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted January 9, 2016 Share Posted January 9, 2016 I can confirm the Prefab idea doesn't solve the problem. Interesting. Quote Link to comment Share on other sites More sharing options...
Josh Posted January 9, 2016 Share Posted January 9, 2016 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. Quote 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 More sharing options...
Thirsty Panther Posted January 10, 2016 Share Posted January 10, 2016 Attached a blank script to the tube pieces. The tube now rotates but falls thru the floor Quote Link to comment Share on other sites More sharing options...
macklebee Posted January 10, 2016 Share Posted January 10, 2016 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 2 Quote 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 More sharing options...
Thirsty Panther Posted January 10, 2016 Share Posted January 10, 2016 Thanks Mac this method works. Must of been the order I was doing it in. Quote Link to comment Share on other sites More sharing options...
Angelwolf Posted January 10, 2016 Share Posted January 10, 2016 Another example of multiple leadwerks users working together to solve one issue for an individual. This is what I love about the LE community. 2 Quote My Games: Nightmare Prism:::WolfTale:::Dungeon Creeper:::Despair of Ordinary Men:::Piano Simulator 2016:::House (W.I.P) Link to comment Share on other sites More sharing options...
Rick Posted January 10, 2016 Share Posted January 10, 2016 I'm thinking when carve happens LE should make a hierarchy of the remaining pieces automatically for us. I have to imagine keeping the pieces together is what ppl want more than not. 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted January 10, 2016 Share Posted January 10, 2016 Compound Primitives -> Tube Quote 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 More sharing options...
Rick Posted January 10, 2016 Share Posted January 10, 2016 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. 1 Quote Link to comment Share on other sites More sharing options...
macklebee Posted January 10, 2016 Share Posted January 10, 2016 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. Quote 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 More sharing options...
macklebee Posted January 10, 2016 Share Posted January 10, 2016 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. 2 Quote 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 More sharing options...
onaid Posted January 11, 2016 Author Share Posted January 11, 2016 Thanks guys very much again 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 that cheers to everyone for your help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.