Need help with this code snippet

Posted By: DarkProgrammer

Need help with this code snippet - 05/05/14 15:34

I need some help with this code. Just started playing around Lite-C. after running it the display is blank. I expected a rotating sphere to appear. I thought the line ENTITY* sphere = ent_create("sphere.mdl",vector(0,0,0),NULL); would create a sphere primitive shape that would get rotated. Any advice would be helpful, so, thanks in advance.

Code:
#include <acknex.h>
#include <atypes.h>
#include <default.c>

function  main()
{
   level_load(""); // open an empty level. you can use NULL instead of ""
   ENTITY* sphere = ent_create("sphere.mdl",vector(0,0,0),NULL); // create sphere model at position (0,0,0)
   while(1) 
   {
      sphere->pan += 1; // rotate the sphere with 1 degree per frame
      wait(1);  // wait one frame
   }
}

Posted By: MasterQ32

Re: Need help with this code snippet - 05/05/14 15:41

works everthing perfect (and as excpected ;))
You don't see the sphere because you are IN the sphere. Create the sphere at
vector(100, 0, 0)
and try again
Posted By: Superku

Re: Need help with this code snippet - 05/05/14 15:45

There's one small other thing to note and that is that you may see a different sphere in the engine than you have in your work folder (I'm not completely sure, though). Should it happen then the reason is that CUBE_MDL (probably "cube.mdl") and SPHERE_MDL are pre-defined objects and will/ could override your objects called cube and sphere. (The obvious solution is to change your model names.)
Posted By: MasterQ32

Re: Need help with this code snippet - 05/05/14 16:24

the internal models are _cube.mdl and _sphere.mdl so SHOULD not matter
Posted By: DarkProgrammer

Re: Need help with this code snippet - 05/05/14 16:31

Thanks guys, the help is awesome.
Posted By: Superku

Re: Need help with this code snippet - 05/05/14 16:48

You are right, the defines/ file names have changed (German thread: http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=399489#Post399489).
© 2024 lite-C Forums