3D Primitives -Cone ,Cube, Cylinder, Sphere & Sphere2

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
xAction
Posts: 86
Joined: Sun Oct 03, 2021 4:14 am

3D Primitives -Cone ,Cube, Cylinder, Sphere & Sphere2

Post by xAction » Sun Oct 24, 2021 3:43 am

3D_Primitives_Basic_v2.png
3D_Primitives_Basic_v6.zip
(11.7 KiB) Downloaded 79 times
3D without math! Well some math, but not my math.
The smart math comes from Skytopia.

I just took basic Livecode graphic line objects, extruded the points into 3D space, or flipped them into 3D slpace?

For 3 Days I looked for a solution for the sphere, all kinds of gobbledeygook code that I broke trying to reconifigure for Livecode. You know how easy it was? Take a circle, copy its points, put the Y in the Z for the vertical cross section, put the X in the Z for the horizontal section, adjust a dangling points on the lines and you got yourself a flying sphere-ish thing. A full tri-mesh polygon sphere is still beyond my grasp.

Now a single function and handler pair manges the custom properties that define each objects origin state.
setXYZ takes a paramenter object, an X,Y, or Z index name, the position in the array, and finally the value ot stick in there.
Then it combines "xyz" & the object name & "Arrray" to identify the array to manage
Then it sticks the value in the X, Y or Z sub index

getXYZ gets the value back from the array in the same way: Object name, x,y or z, index number

Once the arrays custom properties are set, as they are now, they don't need to be reset, but if you move the scripts to a new stack, you'll need to run their Init<shape> code at least once...with the appropriate paired objects as seen in their Define...handlers.

Oh and tilde key ,ie the key to the left of the 1 key toggles the vertice identifying circles of the cube on and off.

Okay, have fun!

xAction
Posts: 86
Joined: Sun Oct 03, 2021 4:14 am

Re: 3D Primitives -Cone ,Cube, Cylinder, Sphere & Sphere2

Post by xAction » Wed Oct 27, 2021 2:22 pm

There was an extra bracketed variable in the cylinder loop causing it not to draw correctly, stack updated in post above.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”