base.camLens.setFov(99) base.camLens.setNear(1.0)
from direct.gui.OnscreenText import OnscreenText textobject = OnscreenText(pos = (0, -0.9), fg = (1,1,1,1), bg = (0.3, 0.3, 0.3, 0.5), align = TextNode.ACenter, scale = 0.07, mayChange = True)
You can look up the various creation parameters for OnscreenText. And then any time you want to display some text, just set the text property for this object. The following code sets the text to the current camera location values using a python formatted string
textobject.setText("Your location is (%2.2f,%2.2f,%2.2f)" % (base.camera.getX(), base.camera.getY(), base.camera.getZ()))
# HINT - Loading a model model = loader.loadModel("model.egg") # HINT - Instancing it to a new pathnode mypanel = root.attachNewNode("some panel") model.instanceTo(mypanel)
# HINT - Creating a 3D audio manager # Note that 'reference_point' could be the pathnode of a listener's location audio3d = Audio3DManager.Audio3DManager(base.sfxManagerList[0], reference_point) audio3d.setDropOffFactor(99) # HINT - Loading a 3D sound and attaching it to an object sound = audio3d.loadSfx('mysound.wav') sound.setVolume(0.5) audio3d.attachSoundToObject(sound, object ) audio3d.setSoundMinDistance(sound, 1.0) sound.play()
# HINT - Adding fog to a sub-tree starting at 'root' (could also be a node to a single model) fog = Fog("Fog") fog.setColor(0.6,0.6,0.8) fog.setExpDensity(0.02) root.setFog(fog)
model.setTransparency(TransparencyAttrib.MAlpha)