January 19, 2021, 06:08:31 AM

Author Topic: [bb] Simple Entity Parent by Blitzplotter [ 1 day ago ]  (Read 638 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Simple Entity Parent by Blitzplotter [ 1 day ago ]
« on: June 29, 2017, 12:28:40 AM »
Title : Simple Entity Parent
Author : Blitzplotter
Posted : 1 day ago

Description : 6 cylinders parented, use the parent handle to rotate. The MGParent entity can be exported to an STL file using Tom Toads stl_exporter utility, link embedded in code.

Code :
Code: BlitzBasic
  1. ; entity_parent.bb
  2. ; Welding 6 cylinders and parenting them to a single entity
  3. ; By Blitzplotter - Jun 2017
  4. ; Successfull export of .STL can be tested by using blender
  5.  
  6.  
  7. ; Use TomToads STL Exporter File
  8. ; available here:
  9. ; https://www.blitzbasic.com/codearcs/codearcs.php?code=3271
  10.  
  11. Graphics3D 800,600
  12.  
  13. Dim ARYcylinder(6)
  14.  
  15. Global MGparent=CreateCylinder()
  16.  
  17. For x=1 To 6
  18.        
  19.         ARYcylinder(x)=CreateCylinder(36)
  20.        
  21.         ScaleEntity ARYcylinder(x),3,60,3
  22.        
  23.         RotateEntity ARYcylinder(x),x*45,0,0
  24.        
  25.         ;add each of the cylinders to a parent entity
  26.         EntityParent ARYcylinder(x),MGparent
  27.        
  28. Next
  29.  
  30.  
  31. pivot=CreatePivot()
  32. cam=CreateCamera( pivot )
  33. PositionEntity cam,0,0,-100
  34.  
  35. lit=CreateLight()
  36. RotateEntity lit,45,45,0
  37.  
  38. spin_this=1
  39.  
  40. ; Use TomToads STL Exporter File
  41. ; available here:
  42. ; https://www.blitzbasic.com/codearcs/codearcs.php?code=3271
  43.  
  44. ;------------------------
  45. Include "./STL_Export.bb"
  46. ;------------------------
  47.  
  48. While Not KeyHit(1)
  49.        
  50.         RotateEntity MGparent,1,spin_this,0
  51.        
  52.         UpdateWorld()
  53.         RenderWorld()
  54.        
  55.         Flip
  56.        
  57.         VWait 120
  58.        
  59.         spin_this = spin_this +1
  60.        
  61. Wend


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal