[Mojo3d] World to Screen / TransformVector

About Monkey 2 Forums Monkey 2 Programming Help [Mojo3d] World to Screen / TransformVector

This topic contains 5 replies, has 2 voices, and was last updated by  Ethernaut 1 year, 3 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #12760

    Xaron
    Participant

    Hey there,

    another question: In mojo3d how can I get the screen coordinates of a 3d object which is within the camera’s FOV?

    And: How do I transform a vector/point from local to world space and vice versa? Just having BlitzBasic3d in mind and those commands were very handy! Thanks!

    #12768

    Xaron
    Participant

    Sorry for bumping. No idea so far? I’d need the screen coordinates of enemy vessels for my HUD. What I basically want to achieve is something like this (screen is from my BB3D project):

    And that TransformVector stuff is very handy for all those torpedo targeting projection stuff…

    I’d love to use mx2 with mojo3d for this. 🙂

    THANKS!

    Attachments:
    #12770

    Ethernaut
    Participant

    I started work on a wireframe renderer a while ago, but never finished it.
    It used “Camera.ProjectToViewPort( Vec3f )” to work. Haven’t tried it in a while, maybe still works…

    #12773

    Xaron
    Participant

    Awesome, thanks! Should look into all those classes. I think I’m going to write all this down and create kind of a “how to start with mojo3d” document at some point.

    #12791

    Ethernaut
    Participant

    Actually, you can remove the “If( ( Abs(s0.X) / camera.Viewport.Width ) < 2.0 )And ( ( Abs(s0.Y) / camera.Viewport.Height ) < 2.0 )” lines…

    The only reason I have those is because I use coordinates (0,0) at the center of the screen, not at the corner… you can just remove those checks.

    Here’s how it looks like when you feed that method all the points in a mesh.
    (The render time is usually around a millisecond… I think the screen capture messed it up).

    I never got backface culling working, though. Now that I think about it… how would you do that? Hmmm…
    Cheers!

    #12792

    Ethernaut
    Participant

    Oh, and the best way to “inspect” mojo classes, in my opinion, is from within Ted2Go!

    You can go to the “docs” tab, move it to the side dock (yes you can dock it!) and start typing the class you want, with the namespace in it, like “mojo3d.mesh” (capitalization doesn’t seem to matter) and hit enter. Every time you hit enter, a similar result will be shown.

    Hitting F1 twice with the cursor in a keyword also works. Not always, though. Typing the namespace seems more consistent.

    Cheers.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.