Is it Possible to Detect Meshdrawer Collisions?

what do you mean by this?

In what context do you want to use this.
You have an actor - you need to use collision primitives.
CollisionRay is suitable for the beam. However, you can do it your own way, as suggested @rdb

sorry which part are you referring to?

  1. Collision Solids
  2. Collision Handlers
  3. Collision Entries
  4. Collision Traversers
  5. Collision Bitmasks

I kind of already gave you the link: https://www.panda3d.org/manual/?title=Collision_Detection, I will give more: https://www.panda3d.org/manual/?title=Collision_Bitmasks

I don’t want to use up any more of your time but if you have any, can you please explain in detail why and what the solution is? I’m really confused with all these terms and everything

Thank you so much

The to use geometry without writing the name {type [flags]} flag in egg.

from direct.showbase.ShowBase import ShowBase
from direct.showbase.DirectObject import DirectObject

from panda3d.core import CollisionTraverser
from panda3d.core import CollisionHandlerQueue, CollisionNode, BitMask32
from panda3d.core import CollisionRay

class MyApp(ShowBase):
 
    def __init__(self):
        ShowBase.__init__(self)
        
        base.cTrav = CollisionTraverser()
        collHandler = CollisionHandlerQueue()
        
        ralph = loader.loadModel("smiley")
        ralph.setCollideMask(BitMask32.bit(0))
        ralph.reparentTo(render)

        pointerNode = render.attachNewNode("Main Collider")
        pointerNode.setPos(0, 0, 15)
        raySolid = CollisionRay(0, 0, 0, 0, 0, -1)

        collNode = CollisionNode("collNode")
        collNode.addSolid(raySolid)
        collisionNodepath = pointerNode.attachNewNode(collNode)
        collisionNodepath.show()
        
        mainCollisionNode = collisionNodepath.node()
        mainCollisionNode.setFromCollideMask(BitMask32(1))
        base.cTrav.addCollider(collisionNodepath, collHandler)

        base.cTrav.showCollisions(render)

app = MyApp()
app.run()

This code does not answer the question. The question is how to detect a collision using the generated geometry with the intersection of the emoticon. Essentially use geometry instead of raySolid. This is the meaning of this post. I will leave this question knowledgeable.

I’m still really confused on what you’re saying, your explanation was rather fast not to sound rude.

I don’t even know what you’re saying here

The meaning of this post !!!

yes I know, no need to start virtually yelling. I’m just saying I don’t understand how this all works. Just remember I’m still a beginner, I don’t know what generated geometry, flags, bitmasks are. All of this can be intimidating to a noob like me, and what’s worse is you just flat out lampooning me. Let’s have a civil conversation shall we?

Did I give you a code to ask me questions again? How about thinking …
The point from your post is the detection of a collision of one geometry using another geometry. I gave you a short code to rethink the approach.

See the problem with just giving code is that you’re not actually teaching the person. I don’t even know what it does, your explanation doesn’t help either.

When I asked for you to help me understand you just said:

My exact point. You don’t have to be a total douche you know

I can teach, everything described in this code is described here. And this is not a joke.
https://www.panda3d.org/manual/?title=Collision_Detection

Let us remain professional, please.

If you are struggling with the official manual, maybe it would help to work through Thaumaturge’s tutorial, which has several chapters on collisions?

I would also recommend experimenting with the various collision sample programs to get a better feel for how the collision system works. This will help you to understand serega-kkz’s sample code and will make it more obvious what solution to apply here.

In general, the assumption made when posting in a forum like this one is that you have already researched available documentation for the solution, and gathered a basic understanding of the engine by following beginner’s tutorials and experimenting with sample code. Doing this will greatly help you to be able to find solutions on your own, and will make it easier to understand the solutions proposed in the forum. In this case, the answer really is covered by the manual, and well-demonstrated by serega-kkz’s simple sample program above.

I appreciate your advice but, in the tutorial the collision detection was for the actor and walls. I want to detect if the meshdrawer touches the .egg model. That’s the part I’m confused about, how do I implement the same principles?

The collision system requires setting up a “from” and an “into” solid. In this case, the geometry generated by the MeshDrawer would serve as your “into” solid. The NodePath method “setCollideMask”, when called on the part of the scene graph to which the MeshDrawer renders, can be used to set up this geometry as an “into” solid.

The rest is the same as any other part of the collision system; set up your .egg model as a “from” solid (by adding a sphere to it, or a box, whichever other “from” solid fits your geometry best), and add it to a collision handler.

So same thing then? Also may I ask any problems I’m facing in scripting issues, asking because I don’t want to post if it’s considered the same topic.

thanks!

Yes, geometry that has been created this way works in the same way as any “into” solid, as long as you set a proper collision mask.

Yes, you can ask question like this one in Scripting Issues. If you have different questions that are not directly related, it is better to open a new thread than to ask in the same thread.

But the problem is that he wants both “from”

Sorry, but in a short example I made a noob error, now it’s fixed.

from direct.showbase.ShowBase import ShowBase
from direct.showbase.DirectObject import DirectObject

from panda3d.core import CollisionTraverser, CollisionHandlerQueue, CollisionNode, BitMask32, CollisionRay

class MyApp(ShowBase):
 
    def __init__(self):
        ShowBase.__init__(self)
        
        base.cTrav = CollisionTraverser()
        collHandler = CollisionHandlerQueue()
        
        ralph = loader.loadModel("smiley")
        ralph.setCollideMask(BitMask32(1))
        ralph.reparentTo(render)

        pointerNode = render.attachNewNode("Main Collider")
        pointerNode.setPos(0, 0, 15)

        raySolid = CollisionRay(0, 0, 0, 0, 0, -1)

        collNode = CollisionNode("collNode")
        collNode.addSolid(raySolid)
        collisionNodepath = pointerNode.attachNewNode(collNode)
        collisionNodepath.show()
        
        mainCollisionNode = collisionNodepath.node()
        mainCollisionNode.setFromCollideMask(BitMask32(1))
        base.cTrav.addCollider(collisionNodepath, collHandler)

        base.cTrav.showCollisions(render)

app = MyApp()
app.run()

BitMask32.bit(0) and BitMask32(1)
This is only confusing.

See now I’m confused, what should I do? You just said @rdb was wrong, what approach do I take?