cross = [“crosshair.jpeg”]
OnscreenImage(cross, pos = Vec2(mmx, mmy))
mmx and mmy are the coordinates of the middle of the screen. I can’t see the image when I run this, why?
cross = [“crosshair.jpeg”]
OnscreenImage(cross, pos = Vec2(mmx, mmy))
mmx and mmy are the coordinates of the middle of the screen. I can’t see the image when I run this, why?
Try:
cross = ["crosshair.jpeg"]
OnscreenImage(cross, pos = Vec3(mmx,0, mmy))
The screen (or aspect2d if you will) in Panda3D is also in the z-up xyz convention. The X axis is left-right, Y is forward-back and Z is up-down.
OnscreenImage(self.cross, pos = Vec3(bmx, 0, bmy))
File "C:\Panda3D-1.7.2\direct\gui\OnscreenImage.py", line 57, in __init__
self.setPos(pos)
AssertionError: !is_empty() at line 1258 of panda/src/pgraph/nodePath.cxx
bump
Instead of passing crosshair.jpg as a one-item list, pass it as a single string:
cross = "crosshair.jpeg"
David
Thank you for replying.
It works, but panda can’t find my textures within a folder named “models”. How can I tell it where to look for textures?
You can give it an explicit path to your textures, instead of just a simple filename; or you can add the directories you want to search to your Config.prc file with the model-path line, e.g.
model-path /c/my/texture/directory
Note that you should observe the Panda filename syntax, as described in the manual.
David
Thanks for replying.
I tried passing a textures folder as a model path, but it still doesn’t register.
I’m just guessing, but I think this looks suspicious:
# Enable the model-cache, but only for models, not textures.
model-cache-dir $USER_APPDATA/Panda3D-1.7/cache
model-cache-textures #f
I tried #t on the second line but it didn’t do anything.
Thanks.
The model-cache-dir isn’t related to model-path.
I assure you that if your texture is in a directory that is named on the model-path, then loadTexture(‘filename’) will find it. If you say that’s not working, then either (a) you’ve got a typo in the directory name or filename (maybe the wrong case for instance), or (b) you’re editing the wrong Config.prc file for some reason, or © something else is going wrong.
Is there a particular error message?
David