TGC Codebase Backup



simple revolving cone example by Skier Demon

6th Jun 2004 21:41
Summary

This will make a sphere and a cone. The cone will revolve around the sphere.



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    `CODE BY SKIER DEMON

`Make main camera
Make Camera 1

`Position the main camera
Position Camera 1,30,2,10

`Make matrix
Make Matrix 1,60,60,60,60

`Position matrix
Position Matrix 1,0,0,0

`Make sphere for cone to revolve around
Make Object Sphere 2,1

`Position sphere
Position Object 2,30,2,30

`Make cone that will revolve around sphere
make object cone 3,2

`Posiion cone
Position Object 3,30,2,20

`Begin loop
Do

`The first line will point object 3 (which is the cone) at Object Position x(2),Object Position y(2),Object Position z(2).
`Object Position x(2) means the X position of object 2 (the sphere)
`Object Position y(2) means the Y position of object 2 (the sphere)
`Object Position z(2) means the Z position of object 2 (the sphere)
`This will make it so the cone will ALWAYS point at the the sphere
Point Object 3,Object Position x(2),Object Position y(2),Object Position z(2)
`This will move the cone right. But becasue the cone is always pointing to the sphere, it will go around in a cirlce (going right, but at the same time pointing to the sphere)
Move Object right 3,0.1

`End loop
Loop

`And tehre you have it. A simple revolving cone example.