Hi,
I just want to mention an annoying behaviour that has been bugging my code for some days. Although basic it was well hidden so I just over simplifyied it to bring it to your attention.
So, I have an object that I want to be picked up alternatively by picker0 or picker1.
One can assumes for instance that the object is a book that will be passed from avatar0 to avatar1.
At load time I know the dimensions of the object and the avatars and I scale them properly in the scene.
The issue is the following, whenever the object is passed (reparented) from picker0 to picker1, its size changes… which is quite annoying.
import direct.directbase.DirectStart
from pandac.PandaModules import *
import time
import sys
class TEST(object):
def __init__(self):
""" simple coordinate test """
base.disableMouse()
# picker 0
self.p0 = loader.loadModel('unit_cube.egg')
self.p0.reparentTo(render)
self.p0.setScale(1,1,1) # scale 1
self.p0.setColor(1,0,0,1) # red
self.p0.setPos(-10,0,0)
# picker 1
self.p1 = loader.loadModel('unit_cube.egg')
self.p1.reparentTo(render)
self.p1.setScale(5,5,5) # scale 5
self.p1.setColor(0,0,1,1) # blue
self.p1.setPos(10,0,0)
# object
self.obj = loader.loadModel('unit_cube.egg')
self.obj.reparentTo(render)
self.obj.setScale(1,1,1) # scale 1
self.obj.setColor(0,1,0,1) # green
self.obj.setPos(0,0,0)
base.camera.setPos(0,-200,0)
base.accept( "escape", sys.exit)
self.toggle = True
taskMgr.add(self.Update,'toggle_reparent')
def Update(self,task):
""" makes the object move to new father """
if self.toggle:
self.obj.reparentTo(self.p0)
self.obj.setPos(0,0,5)
else:
self.obj.reparentTo(self.p1)
self.obj.setPos(0,0,5)
time.sleep(1)
self.toggle = not self.toggle
return task.cont
TEST()
run()
Have a look, you’ll see the annoyance, since it is not assumed to change shape or size !!
So my question is the following: is there a simple way, once objects model are loaded into Panda scene, to make sure that after having resized them properly at init, they don’t change size anylonger (unless asked)???
thks,
Jean-Claude