Code archives/3D Graphics - Effects/Simple Entity Parent

This code has been declared by its author to be Public Domain code.

Download source code

Simple Entity Parent by BlitzplotterJune
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.
; entity_parent.bb
; Welding 6 cylinders and parenting them to a single entity
; By Blitzplotter - Jun 2017
; Successfull export of .STL can be tested by using blender


; Use TomToads STL Exporter File
; available here:
; https://www.blitzbasic.com/codearcs/codearcs.php?code=3271

Graphics3D 800,600

Dim ARYcylinder(6)

Global MGparent=CreateCylinder()

For x=1 To 6
	
	ARYcylinder(x)=CreateCylinder(36)
	
	ScaleEntity ARYcylinder(x),3,60,3
	
	RotateEntity ARYcylinder(x),x*45,0,0
	
	;add each of the cylinders to a parent entity
	EntityParent ARYcylinder(x),MGparent
	
Next


pivot=CreatePivot()
cam=CreateCamera( pivot )
PositionEntity cam,0,0,-100

lit=CreateLight()
RotateEntity lit,45,45,0

spin_this=1

; Use TomToads STL Exporter File
; available here:
; https://www.blitzbasic.com/codearcs/codearcs.php?code=3271

;------------------------
Include "./STL_Export.bb"
;------------------------

While Not KeyHit(1)
	
	RotateEntity MGparent,1,spin_this,0
	
	UpdateWorld()
	RenderWorld()
	
	Flip
	
	VWait 120
	
	spin_this = spin_this +1
	
Wend

Comments

None.

Code Archives Forum