Could someone please let me know why CameraPick doesn't pick model in the following code?
#include "engine.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
Initialize();
Graphics(640,480);
TFramework fw = CreateFramework();
SetGlobalObject("fw",fw);
TCamera camera=GetLayerCamera(GetFrameworkLayer(0));
PositionEntity(camera,Vec3(0,5,-12));
RotateEntity(camera,Vec3(15,0,0));
TLight light=CreateDirectionalLight();
RotateEntity(light,Vec3(45,45,45));
TMesh cube=CreateCube();
EntityType(cube,1);
TMesh model=LoadModel("abstract::frame.gmf");
PositionEntity(model,Vec3(1,1,0));
EntityType(model,1);
Collisions(1,1,true);
while(!KeyHit(KEY_ESCAPE))
{
TPick pick;
UpdateFramework();
RenderFramework();
if(CameraPick(&pick,camera,Vec3(MouseX(),MouseY(),1000),0,1)) DrawText(0,20,"HIT");
Flip(0);
}
return 1;
}
As it stands, CameraPick only picks the cube. If I change the collision type to 0, it selects both the cube and the model. Any ideas?