Beispiel #1
0
Entity *newCube(Vec3D position,const char *name)
{
    Entity * ent;
    char buffer[255];
    int i;
    ent = entity_new();
    if (!ent)
    {
        return NULL;
    }
    /*for (i = 0; i < 24;i++)
    {
        //sprintf(buffer,"models/robot/walk_bot_%06i.obj",i + 1);
        ent->objAnimation[i] = obj_load(buffer);
    }*/
    ent->objModel = obj_load("models/cube.obj");//ent->objAnimation[0];
	if( !ent->objModel )
		slog( "test" );
    ent->texture = LoadSprite("models/cube_text.png",1024,1024); //LoadSprite("models/robot/robot.png",1024,1024);
    vec3d_cpy(ent->body.position,position);
	vec3d_set(ent->scale,1,1,1);
	vec3d_set(ent->rotation,0,0,0);
	vec4d_set(ent->color,1,1,1,1);
    cube_set(ent->body.bounds,-1,-1,-1,2,2,2);
    ent->rotation.x = 90;
    sprintf(ent->name,"%s",name);
    ent->think = think;
    ent->state = 0;
    mgl_callback_set(&ent->body.touch,touch_callback,ent);
    return ent;
}
Beispiel #2
0
Entity *newCube(Vec3D position,const char *name)
{
    Entity * ent;
    ent = entity_new();
    if (!ent)
    {
        return NULL;
    }
    ent->objModel = obj_load("models/cube.obj");
    ent->texture = LoadSprite("models/cube_text.png",1024,1024);
    vec3d_cpy(ent->body.position,position);
    cube_set(ent->body.bounds,-1,-1,-1,2,2,2);
    sprintf(ent->name,"%s",name);
    mgl_callback_set(&ent->body.touch,touch_callback,ent);
	ent->body.id = -3;
    return ent;
}