Has anyone had any success with a true mouse coordinate project/unproject?
I know unproject should be:
INV( Projection*ModelView ) * ( x,y,z,1 )
Getting the projection matrix is easy enough, but is getWorldToCamera the same thing as the Model View matrix ? It doesn’t seem to work when I use that.
It would be easy enough to implement this in the Blender sourcecode, having a camera.unproject using glu, but i’m looking for a python workaround.
It all depends on what you are exactly trying to do. No need to get matrix math involved unless it is absolutely neccesary, this is something you need to remember considering python is a scripting language and not a programming one and so does not have the benifit of speed.
Yea shure we could make a nifty little function to do that. But snailrose is to busy redoing the entire freaking engine, and I have very large software projects these days.
Tell what you need the mouse for exactly and someone should be able to help you out. I would but I wont have comp access for the next 2 days. If nobody has helped by then, I will.
I would like to translate 3d coords to screen coords.
Python is pretty fast, I only mention glu… because compiled c is
generally faster( and already implemented ). I have an implementation running, it works at a fast speed, but my hang-up is getting the modelview matrix.
What exactly is getWorldToCamera? It sounds like modelview, but it
doesn’t seem to work correctly. I’ll post the code next time I boot
windows.
Re: glu,
Yeah sr is doing great work, I may look into it myself.
And, Python IS a programming language. It even says so on the website. It’s just powerful, i mean in one line you can calculate primes < n:
[ i for i in range(2,n) if i not in [ a*b for a in range(2,b/2) for b in range(2,n/2) ] ]
What do you mean translate 3d coords to screen coords? Do you want a display on the screen to print out the 3d coordinates or what?
PS:
Be they written in either C or Python, scripts are generally several lines of code which do some useful function. So in turn any programming language could also be reffered to as a scripting language.
Python is a high-level, object oriented, non-compiled, full fledged “programming” language.
Actually I like to think of it as being the programming language of the future, since the goal has always been to make code easier to understand, and do more with less. Python has been hitting very close to that mark, hence it’s popularity, which is quite astounding considering it’s age.
I want to implement a mouse drag. I actually think that means I need
to translate mouse to 3d.
Just to make sure, getWorldToCamera is the modelview or projection*modelview? I’m sure I’ll figure it out in testing but I would like confirmation if anyone knows.
ps: I agree python is great.
on nix:
import glob; print "
".join([str[9:-3] for str in sorted(glob.glob( "/usr/lib/.so" ))])