After I move a BulletRigidBodyNode , I can't click it

def __init__(self):
		ShowBase.__init__(self) = BulletWorld()
		base.disableMouse() = Map2()
		# 显示所有节点
		self.squareRoot = render.attachNewNode("squareRoot")
		# 节点保留路径位置
		self.pathPos = []
		for i in
			tools = loader.loadModel("egg/tiles")
			# 设置标签
			tools.setTag('CollisionTag', str(i))
			# 设置 Bullet 的静态物体
			shape = BulletBoxShape(Vec3(1,1,0.1))
			np = render.attachNewNode(self.pathPos[-1])
			# 将模型加入碰撞物体

		# 当前选择的物体
		self.pathFocus = self.pathPos[0]

The self.pathFocus is selected object .

	def mouse1(self):

		# 获得鼠标的位置
		mpos = base.mouseWatcherNode.getMouse()
		# 获得两个点
		pFrom = Point3()
		pTo = Point3()
		base.camLens.extrude(mpos, pFrom, pTo)
		# 转换为全局坐标
		pFrom = render.getRelativePoint(, pFrom)
		pTo = render.getRelativePoint(, pTo)
		# 根据鼠标的位置设置碰撞射线的位置
		result =, pTo)
		self.pathFocus = result.getNode()

I use mouse1 change self.pathFocus

	def moveL(self):
		node = render.attachNewNode(self.pathFocus)
	def moveR(self):
		node = render.attachNewNode(self.pathFocus)

When I called moveL or moveR , them click it , the self.pathFocus = null .
By the way , I use panda3d1.8_1.8.0+cvs20110810~natty67_amd64 .


	def moveL(self):
		node = render.attachNewNode(self.pathFocus)
		print self.pathFocus
	def moveR(self):
		node = render.attachNewNode(self.pathFocus)
	def moveF(self):
		node = render.attachNewNode(self.pathFocus)
	def moveB(self):
		node = render.attachNewNode(self.pathFocus)
	def moveU(self):
		node = render.attachNewNode(self.pathFocus)
	def moveD(self):
		node = render.attachNewNode(self.pathFocus)

I would like to suggest another way of handling your case.

First, we should look at the problem. The raytest result method “getNode” returns a PandaNode. You store this node in self.pathNode. Later, inside “moveL” etc. you want to modify the node’s transform. This can be done in two ways:
(1) node.getTransfrom --> create a new TransformState based on the one returned --> node.setTransform
(2) get a NodePath handle to the node, the use setPos on the NodePath.

The second method is more convenient, usually, since most users don’t want to mess with TransformStates.

What you do is neither of the to ways; you attach the node a second time to the scene graph (render.attachNewNode), which returns a NodePath to the newly attached node. Then you use setPos on this new nodePath. The problem is that you effectively create a new node in the scene graph.

This is how it can be done better:
(1) don’t store the node returned by the raycase, but a handle to it:

result =, pTo)
resultNode = result.getNode()
resultNP = NodePath.anyPath(node)
self.pathFocus =  resultNP

(2) Now you just have to call setPos on self.pathFocus, since this member is now a NodePath (and not a PandaNode).

def modelL(self):
    self.pathFocus.setPos(self.pathFocus, Point3(-1,0,0))

Oh, and you should definitely add some code which catches the case when you raycast doesn’t hit a body (empty result, getNode returns None).

Thank you ! Before I stranger to anyPath() .