Temporary Disable Collisions

I have a picking ray for picking objects in the world; the picking ray will constantly cause collision even when the picking is over.

What would be the best method for stopping my Picking Ray from causing collision (disabling it) when it’s not being used to pick an object?

A CollisionRay tests for collisions when it is added to a CollisionTraverser, and CollisionTraverser.traverse() is called. Therefore, to avoid testing for unwanted collisions, either don’t call CollisionTraverser.traverse(), or remove the ray from the traverser.

David

I did something less painful -

I just set the “fromCollideMask” to 0 after picking was over. It must have worked because the fps drop I was getting from the ray constantly registering with my Actor stopped.

I remembered that colliders become “Froms” when added to the traverser and everything else become into. So I figured I would just kill the “From” side of my Picking Ray, since the into side was already 0.

That works too. To me, that seems like the clumsier solution, but whatever works for you is the right answer. :slight_smile:

David

I do have two methods set up in my Class that handles movement updates and collisions; one of the functions sets up collisions with the Trav and the other removes them.

I would run into a problem where I would need my Picking Ray to Pick, but it will stall because of the collision ray being out of the Trav.

I used the solution that would make it much easier to manage; most likely because of the way I have written my code. Things are going to get even more complex as I go along.

Motion planning is going to kill me. There are two ways I can tackle that, but I won’t think about it much until the time comes.

Just in case anyone is wondering what I’m up to, I’m going to create a City Builder game. Not just any City Builder; I’m aiming for Children of the Nile, Majesty and old school Warcraft all in one.

I’m styling the game differently; instead of going with a title layout, players will be able to just place objects where they want to freely.

The game doesn’t look like much right now since I’m just working on the GUI and basic logic for all parts of the game. The GUI will take me a little more time since I’m coding it from scratch (that is, I’m not using the Panda’s direct gui buttons and stuff. Had issues with those).

I was able to stay above 30 fps with 100 characters on screen (on a 32 bit system with an old graphic card).

That will be suitable for my game, since it’s not about having hundreds of moving bodies on screen, but smaller numbers of representation.