SpiderPig Posted November 7, 2010 Share Posted November 7, 2010 Hi, CameraPick() is givening me the following error; "Unhandled exception at 0x752c9b60 in game-Release.exe: 0xC0000005: Access violation writing location 0x00000000." and then it goes to this line in "Disassembly"; "752C9B60 rep movs dword ptr es:[edi],dword ptr [esi] " This is my code; TPick* pick while( !KeyHit() && !AppTerminate() ) { if( !AppSuspended() ) // We are not in focus! { if(MouseHit(1)) { if(CameraPick(pick,camera,Vec3(MouseX(),MouseY(),100),2,0,0)) { EntityColor(pick->entity,Vec4(0,1,0,0)); }; }; UpdatePlayer(); UpdateAppTime(); UpdateWorld(AppSpeed()) ; // Render SetBuffer(gbuffer); RenderWorld(); SetBuffer(BackBuffer()); RenderLights(gbuffer);//ComputerTexture=GetColorBuffer(BackBuffer(),1); Flip(1) ; } } I tried it without setting the color of the picked entity or a mouse check but it still crashed. What am I missing? Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted November 7, 2010 Author Share Posted November 7, 2010 Haha, Just figured it out once I posted it... I had to do; TPick pick instead of; TPick* pick and call on it like so; if(MouseHit(1)) { if(CameraPick(&pick,camera,Vec3(MouseX(),MouseY(),100),2,0,0)) { EntityColor(pick.entity,Vec4(0,1,0,0)); }; }; Well, hope this helps someone else Though how do I check which entity I'm picking in order to change the color of only that entity? The following code didn't work for me; if(MouseHit(1)) { if(CameraPick(&pick,camera,Vec3(MouseX(),MouseY(),100),2,0,0)) { if(pick.entity==cube) { EntityColor(pick.entity,Vec4(0,1,0,0)); }; }; }; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.