By M. Yadi
M
This tutorial shows how to clone 3D object. Here you will
learn
1.
How to create object
2.
How to clone 3D Object
Our objective will be as shown on below figure
Before we go into the codes, prepare the 3D objects. In this
sample I have a car 3D object, you can have another one. To get free 3D object
you can download it from internet.
Let’s start into the
code
1.
Open Delphi XE6
2.
Choose Firemonkey Mobile Application
3.
Select blank application
4.
For debugging purpose , add Platform on target
platform then select 32Bit Windows, if
your OS is windows 64 bit then choose 64bit Windows
5.
our form design will be like below figure
6.
Lets we define the components one by one
Component
|
Property
|
Value
|
Event
|
TViewport3D
|
Name
|
Viewport3D1
|
|
Align
|
Client
|
||
TDummy
|
Name
|
Dummy1
|
|
Position.X
|
0
|
||
Position.Y
|
0
|
||
Position.Z
|
0
|
||
RotationAngle.X
|
0
|
||
RotationAngle.Y
|
0
|
||
RotationAngle.Z
|
180
|
||
TModel3D
|
Name
|
myCarModel
|
|
MeshCollection
|
Select your Object file
|
||
|
7.
Now create new DataType for our Clone object
8.
Add array variable to put our object, so we can
set number of cloned object we want
9.
Add new procedure to generate number of our
cloned objects
10.
Add below script in implementation
11.
Let’s call our procedure on OnShow Event. I put
3 for number of cloning object, you can change it by any number you want.
12.
Finish, now we can test our Application. Run the
application by Pressing F9
TADAA. Your object is cloned. It‘s Easy right!
Thanks for visiting my Blog.