set pos of RigidBodyCombiner node

Hi all,

I try using the following code:

[b]NodePath * rbcNP;
RigidBodyCombiner rbc("");

NodePath unit;

rbcNP = new NodePath(&_rbc);

unit = rbcNP->attach_new_node("");


And the “unit” is displayed at (0,0,0),
the set_pos doesn’t effect it…
When I print the: “unit.get_pos()” it’s give me the one I set (meaning (100,100,0)).

So why does it display the model at (0,0,0) and not at (100,100,0) as i asked…?

10X !

From the RigidBodyCombiner API page:

Your node does not have a transform on it, nor is it a ModelNode, at the time of collect(), so it does not get identified as a “moving” node.

To fix this, either replace:

unit = rbcNP->attach_new_node("");


unit = rbcNP->attach_new_node(new ModelNode());

or move the call to unit.set_pos() to before the call to collect().

Note that, by the way, NodePath objects are intended to be created directly on the stack, not indirectly via the new operator. So you can do:

NodePath rbcNP(&_rbc);

But this is a minor detail.


First of all,
Thank you David, you are the best!

I try both of your suggestes and still the model is in (0,0,0)… :frowning:

What else can i do?

move the node a tiny bit away from 0,0,0 before you collect them. like 0.0000001 or so.

Thank you ThomasEgi for your repley,
But believe me I try all the combinations,
I try to collect before, after in the middle and so…

Ah, another problem may be the way you are declaring your RBC. Unlike NodePath, RigidBodyCombiner inherits from PandaNode, which inherits from ReferenceCount. All objects that inherit from ReferenceCount must be declared dynamically and stored in a PT() object.

So, you should replace:

RigidBodyCombiner rbc("");


PT(RigidBodyCombiner) rbc = new RigidBodyCombiner("");

Also, I note that you reference a different object, _rbc. Make sure that you don’t have two different RigidBodyCombiner objects here that you’re getting confused with each other.


Thank’s again david,

I change the code as you say to PT, and as you say at your first command (the rbcNP is not a pointer any more…), but still the object is at (0,0,0) and won’t move that location ! :smiling_imp:

So I try to replace the model in the same code with the LineSegs object, and it’s work… !!

Can it be the model? some thing in my egg file?
or may be the code line:
is making the problem?

My code now is looking like this:

[b]NodePath rbcNP;
PT(RigidBodyCombiner)rbc = new RigidBodyCombiner("");

NodePath unit;

rbcNP = NodePath(rbc);

unit = rbcNP.attach_new_node(new ModelNode(""));


DONE ! :laughing:

I just remove the:

character {
{ 1 }

From my egg file, and the unit is no longer at (0,0,0).

Again thank you all for the help!