Question

i've been having this weird error after starting to try out "masking" (halfway through an activity given by a lecturer). The lecturer recommended that i create a new solution. However, after making 3 solutions which produced the same error.

http://puu.sh/1foxu <- Picture of the error

http://pastebin.com/GPsLTjdm <- Pastebin for code (used pastebin because Panda3D thingy is indent sensitive)

Thank you!

Was it helpful?

Solution

Try moving your box model before reparenting it to its bullet node.

self.world.attachRigidBody(np.node())
model = loader.loadModel('models/box.egg')
model.setPos(-0.5,-0.5,-0.5)                   # <- Add this line
model.reparentTo(np)

Adjusting the model position is needed because Bullet shapes assume that the center of the model is its (0,0,0) coordinates, but in most cases the (0,0,0) is actually the bounds of the model.

EDIT:

To solve your texture problem try:

model.setTexture(tex, 1)

...instead of...

model.setTexture(tex)

A fragment from the manual:

Normally, you simply pass 1 as the second parameter to setTexture(). Without this override, the texture that is assigned directly at the Geom level will have precedence over the state change you make at the model node, and the texture change won't be made.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top