Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Help with dbPickObject() function

Author
Message
Patsfanx247
10
Years of Service
User Offline
Joined: 3rd Dec 2013
Location:
Posted: 4th Dec 2013 21:49
I am attempting to use the dbPickObject() function uses the mouse as the pointer to kill zombies that come after you. Although, when I use this function it only recognizes if an object was clicked when it is really close to the camera in a 3d world.

void fireWeapon(int objectEnd)
{
int objectNumber;
objectNumber=dbPickObject(dbMouseX(),dbMouseY(),4,objectEnd);
if(objectNumber>=4)
{
dbHideObject(objectNumber);
}

}

I implement the function by

if(dbMouseClick()==1)
newPlayer.fireWeapon(54);

can someone help me use this function or if anyone has any better ideas?
The Tall Man
11
Years of Service
User Offline
Joined: 16th Nov 2013
Location: Earth
Posted: 12th Dec 2013 23:39 Edited at: 12th Dec 2013 23:55
As a debugging piece of code, this will set whatever object you point to as a wireframe, and leave the rest.

Prior to your loop:


and within your loop:



Works for me... although the wireframes seem to not be showing correctly for scaled objects. But the dbPickObject() command seems to be working well in either case.

Edit: When you hide an object, the pick object command sees through it. So with your code there, it'll see it with one frame, then see whatever's behind it the next, and see what's behind that the next frame, etc.

Login to post a reply

Server time is: 2024-11-18 21:28:36
Your offset time is: 2024-11-18 21:28:36