def setLocationAndRotation(self, location, *args): if len(args) == 3: self._matrix = MathUtil.buildTransformMatrix(location, *args) else: self._matrix = MathUtil.buildTransformMatrixQ(location, *args) if hasattr(self, "body") and self.body is not None: self.body.SetMatrix(self._matrix.toList())
def setLocationAndRotation(self, location, *args ): if len(args) == 3: self._matrix = MathUtil.buildTransformMatrix(location, *args) else: self._matrix = MathUtil.buildTransformMatrixQ(location, *args) if hasattr(self, "body") and self.body is not None: self.body.SetMatrix( self._matrix.toList() )
def setLocationAndRotation(self, location, *args): self.location = location if len(args) == 3: self.yaw, self.pitch, self.roll = args else: self.yaw, self.pitch, self.roll = MathUtil.quaternionToEulerYawPitchRoll(*args) self.construction.setLocation(location, self.yaw, self.pitch, self.roll) self._matrix = MathUtil.buildTransformMatrix(self.location, self.yaw, self.pitch, self.roll)
def draw(self): #find camera's transform matrix m = MathUtil.buildTransformMatrix(self.ent.headLocation, self.ent.yaw + math.pi, self.ent.pitch, self.ent.roll) glPushMatrix() glMultMatrixf(m.toList()) Graphics.drawPyramid(30, 10, 100.0) Graphics.drawWirePyramid(30, 10, 100.0) glPopMatrix()
def setLocationAndRotation(self, location, *args): self.location = location if len(args) == 3: self.yaw, self.pitch, self.roll = args else: self.yaw, self.pitch, self.roll = MathUtil.quaternionToEulerYawPitchRoll( *args) self.construction.setLocation(location, self.yaw, self.pitch, self.roll) self._matrix = MathUtil.buildTransformMatrix(self.location, self.yaw, self.pitch, self.roll)
def draw(self): #find camera's transform matrix m = MathUtil.buildTransformMatrix(self.ent.headLocation, self.ent.yaw + math.pi, self.ent.pitch, self.ent.roll) glPushMatrix() glMultMatrixf( m.toList() ) Graphics.drawPyramid(30, 10, 100.0) Graphics.drawWirePyramid(30, 10, 100.0) glPopMatrix()
def grab(self, thing): self.holding = thing thing.owner = self location = self.location + vec3(0, 9, 0) m = MathUtil.buildTransformMatrix(location, 0, 0, 0) thing.body.SetMatrix(m.toList()) thing.body.SetVelocity(self.body.GetVelocity()) self.slider = self.world.solver.makeSliderJoint( (location.x, location.y, location.z), (0, 1, 0), self.body, thing.body) self.slider.SetMinLimit(7.5) self.slider.SetMaxLimit(10)
def grab(self, thing): self.holding = thing thing.owner = self location = self.location + vec3(0, 9, 0) m = MathUtil.buildTransformMatrix(location, 0, 0, 0) thing.body.SetMatrix(m.toList()) thing.body.SetVelocity(self.body.GetVelocity()) self.slider = self.world.solver.makeSliderJoint( (location.x, location.y, location.z), (0, 1, 0), self.body, thing.body ) self.slider.SetMinLimit(7.5) self.slider.SetMaxLimit(10)
def getTransformMatrix(self): return MathUtil.buildTransformMatrix(self.position, self.yaw, self.pitch, self.roll)
def setLocation(self, location, yaw, pitch, roll): self.location = location self.matrix = MathUtil.buildTransformMatrix(self.location, yaw, pitch, roll) self.body.SetMatrix( self.matrix.toList() )
def setLocation(self, location): self.location = location self.matrix = MathUtil.buildTransformMatrix(self.location, 0, 0, 0) self.body.SetMatrix( self.matrix.toList() )
def setLocation(self, location, yaw, pitch, roll): self.location = location self.matrix = MathUtil.buildTransformMatrix(self.location, yaw, pitch, roll) self.body.SetMatrix(self.matrix.toList())
def setLocation(self, location): self.location = location self.matrix = MathUtil.buildTransformMatrix(self.location, 0, 0, 0) self.body.SetMatrix(self.matrix.toList())
def transformedTo(self, position, yaw, pitch, roll): m = MathUtil.buildTransformMatrix(position, yaw, pitch, roll) return self.transformedBy(m)
def getTransformMatrix(self): return MathUtil.buildTransformMatrix(self.position, self.yaw, self.pitch, self.roll)
def setGraphicsTransform(self): GraphicsCard.multMatrix(MathUtil.buildTransformMatrix(self.location, self.yaw, 0, 0).toList())
def transformedTo( self, position, yaw, pitch, roll ): m = MathUtil.buildTransformMatrix( position, yaw, pitch, roll) return self.transformedBy( m )
def setGraphicsTransform(self): GraphicsCard.multMatrix( MathUtil.buildTransformMatrix(self.location, self.yaw, 0, 0).toList())