modifying engine scene node picking

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

modifying engine scene node picking

Post by kendric »

I want to be able to have a scene node remove itself from being picked if it so chooses.

I see an oppertunity in:
getPickedNodeBB in the collision manager source file.

Basically I would have to add a variable to ISsceneNode such as
pickCatagory.
And then I could have categories such as ALWAYS_PICK,IGNORES_BULLETS ...

Either that or have a function pointer stored on it and then the user could have each model object that wants to filter what picks it set that function to something like allowsPick(PICK_TYPE)

I don't know of a better way to get the engine to exclude certain things.

The use case is I'm firing a bullet and I want to have it pick the closest scene node along the bullets path but it shouldn't hit say a powerup thats floating in front of them.

If anyone has any suggestions on a better way to do this I am all ears.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

There is a bitmask which you can set for each scene node. Depending on the masks you can exclude single or groups of scene nodes from selection. Please read the API and ask again if you don't understand it.
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

Ok i saw that and misunderstood it. I thought you passed the ID of a specific node and it only looked for that. Gotcha ok thanks.
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

well in the while loop u can check if the bullet hit the enemy or not!
so first u must make a virtual box around the enemy lets say with 2 so here it is:

Code: Select all

if (bullet.x>=enemy.x &&bullet.y>=enemy.y&& !(bullet.x>=enemy.x+=2) &&
&& !(bullet.y>=enemy.y+=2))
{
then enemy is hit by the bullet

remove enemy
}
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

I want to be able to have a scene node remove itself from being picked if it so chooses.
I posted some code a while back that made it simple filter pickable nodes in the collision manager. You would make a derived filter type that had a list of scene nodes, and the accept() method would only return true if the provided node was found in that list. You can find the necessary changes to the scene manager code here.

bitplane mentioned that he liked the idea and would put the changes in, but they never made their way into revision control.

Travis
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

Thanks, that is exactly the kinda thing I was thinking of doing.

I've been posting a bunch lately, its because I have been making a newton irrlicht game engine thingy. There are already some out there but I am aiming for this to be more full. So far i have support for monsters, weapons, bullets, physics, and working on letting you see your gun in the main view. There are already a bunch of newton-irlicht things out there but if people want this I may post it when its in a more complete state.

The 2 downsides are
1) I am coding this how my java background prods me to do, so it is highly OO and may have some things that are just not the greatest things to do in C++ since its been so long since I did c++, and I never did it professionally

2)I am not an irrlicht master by any means and I may have done some things that are not the 100% proper way to do things.
Post Reply