I’m currently working on melee combat game with sword and shield and maces.
I’m a bit lost on how to define the collision detection.
From what i understand from the tutorial
I must register geomNode for each object that must be â€œcollideableâ€
Q0) It sounds like you’ve mostly got it. I’m not sure what you mean in the first step, though, when you say 'I must register geomNode for each object that must be â€œcollideableâ€
Trully Panda rocks…
Lot of good news there!!
just one thing i’m confused about.
it’s point 1: you say everything is collideable just have to set bitmask on it.
But in tutorial it’s shown
cSphere = CollisionSphere(Point3(0,0,15),15)
cNode = CollisionNode(“bamboo”)
cNodePath = target.attachNewNode(cNode)
Is the CollisionNode and CollisionSphere needed or they are here “only” to
speed up the process…
or do you mean i can just do a set mask on any actor/model i loaded and collision will be detected with it? (if mask are matching of course)
Anyway big big thanks for your answer , help me a lot to sort it out
Ah, yes. A CollisionNode defines a special kind of geometry that is optimized for detecting collisions, rather than for being rendered. It is an important optimization, especially if your game relies heavily on collision detection, but it is not strictly necessary–any model can be collided with, if you set the bitmasks correctly.
Are all this collision geom (ray,box,segment & sphere) for active collider
available in latest stable version or only in experimental release ?
(or in CVS )
Asking because there was an old post saying collision sphere was the only
possible active collider geom.
(i’ve nearly finished the design of my collision detection system yeahhhhhhhhhhh)
Hmm, it looks like CollisionLine is only available in version 1.0.0, but the other three are in the stable version.
Let me clarify: you can use the sphere, ray and segment in an active role to detect collisions if you use just a CollisionHandlerEvent (which just throws an event but does nothing else), but if you want to use a CollisionHandlerPusher (which would try to move your sword out of other objects), you can only use the sphere. Although I think even this restriction might be lifted in version 1.0.0.
thanks a lot.
In fact i’ve design the collision like this .
I’ve got one CollisionSearcher that setup the same event handler for any collision which fire always the same event
this collisionSearcher also do the Collision traversing, adding and removing collider, giving CollisionGeom to nodes …
Each Scene can create a collisionRuler for the collisionSearcher.
The Collision Ruler receives the event and pass the collision entry to a list of CollisionBehaviours( as well as a pointer to CurrentScene)
Each behaviour is given a chance to happpen by checking the
active and passive node Tags.
Any Nodep. can ask the CollisionRuler to decorate him for a specific behaviour.
The CollisionRuler will add to the nodeP required tags for the behaviour, as
well as required in/out collision mask.
So on paper that sounds good, that compile good also (way to say )
tonight will be testing time.