https://linen.dev logo
Join Discord
Powered by
# lime
  • h

    hallowed-ocean-84954

    05/14/2023, 5:03 AM
    Nice
  • t

    tall-teacher-57409

    05/14/2023, 5:15 AM
    same results, that's my code so far
    Copy code
    hx
    public override function update(deltaTime:Int) {
            var camSpeed = 2.5 * deltaTime;
            if (moveForward) {
                var camFront = cameraFront.clone();
                camFront.scaleBy(camSpeed);
                cameraPos = cameraPos.add(camFront);
            } else if (moveBackward) {
                var camFront = cameraFront.clone();
                camFront.scaleBy(camSpeed);
                cameraPos = cameraPos.subtract(camFront);
            } else if (moveLeft) {
                var camFront = cameraFront.clone();
                camFront.crossProduct(cameraUp).normalize();
                camFront.scaleBy(camSpeed);
                cameraPos = cameraPos.subtract(cameraFront);
            } else if (moveRight) {
                var camFront = cameraFront.clone();
                camFront.crossProduct(cameraUp).normalize();
                camFront.scaleBy(camSpeed);
                cameraPos = cameraPos.add(cameraFront);
            }
        }
    it looks fine to me ig
  • h

    hallowed-ocean-84954

    05/14/2023, 5:17 AM
    does your left/right movement work ?
  • h

    hallowed-ocean-84954

    05/14/2023, 5:19 AM
    this is code from my camera class. It's openfl but I believe the functions basically either change in place or return a new vector in the same ways in openfl and lime:
    Copy code
    case FORWARD:
                    var tgt = cameraFront.clone();
                    tgt.scaleBy(speed);
                    cameraPos = cameraPos.add(tgt);
                case BACKWARD:
                    var tgt = cameraFront.clone();
                    tgt.scaleBy(speed);
                    cameraPos = cameraPos.subtract(tgt);
                case RIGHT:
                    var m = cameraFront.crossProduct(_worldUp);
                    m.normalize();
                    m.scaleBy(speed);
                    cameraPos = cameraPos.subtract(m);
                case LEFT:
                    var m = cameraFront.crossProduct(_worldUp);
                    m.normalize();
                    m.scaleBy(speed);
                    cameraPos = cameraPos.add(m);
  • h

    hallowed-ocean-84954

    05/14/2023, 5:20 AM
    so in the left/right case I would expect you to have to capture the returns from crossProduct() in a new var
  • h

    hallowed-ocean-84954

    05/14/2023, 5:21 AM
    your forward/backward looks the same as mine except whatever is going on with the multiplier
  • t

    tall-teacher-57409

    05/14/2023, 5:21 AM
    yeah that's what im looking already for reference 😁
  • t

    tall-teacher-57409

    05/14/2023, 5:21 AM
    but its the entire movement system is so buggy, I mean it works with the first couple of key strokes, but after that, neither W/S nor A/D work, idk very strange
  • t

    tall-teacher-57409

    05/14/2023, 5:23 AM
    alright
  • h

    hallowed-ocean-84954

    05/14/2023, 5:24 AM
    I believe normalize() modifies in place, so you need to assign the output of crossProduct() to something and then normalize. chaining them and assigning will not work.
  • h

    hallowed-ocean-84954

    05/14/2023, 5:25 AM
    And if you trace the camSpeed what is it showing now with the int deltatime ?
  • t

    tall-teacher-57409

    05/14/2023, 5:56 AM
    values like 70, 60 40..etc
  • t

    tall-teacher-57409

    05/14/2023, 5:56 AM
    still so buggy
  • h

    hallowed-ocean-84954

    05/14/2023, 6:39 AM
    That seems high but makes sense. But that should be scaling but the thing about the first few clicks being on and then nothing more. That sounds really odd
  • t

    tall-teacher-57409

    05/14/2023, 7:17 AM
    yeah and I might not be precise in my explanation, but if possible, you could compile the code and see what I mean
  • m

    modern-quill-15664

    05/14/2023, 9:29 PM
    how can i cancel the window close? i wanna make a popup appear saying theres unsaved changes
  • m

    modern-quill-15664

    05/14/2023, 9:32 PM
    like this
    Copy code
    cpp
    case WM_CLOSE:
        if (MessageBox(hwnd, L"Really quit?", L"My application", MB_OKCANCEL) == IDOK)
        {
            DestroyWindow(hwnd);
        }
        // Else: User canceled. Do nothing.
        return 0;
  • m

    modern-quill-15664

    05/14/2023, 10:02 PM
    edit i found out how
  • m

    modern-quill-15664

    05/14/2023, 10:02 PM
    Copy code
    hx
    Application.current.window.onClose.add(() -> {
        Application.current.window.onClose.cancel();
    });
  • h

    hallowed-ocean-84954

    05/14/2023, 10:50 PM
    ok - figured it out - let me clean it up a bit - I hit a bunch of stuff before I found the real issue - will post a new Gist
  • h

    hallowed-ocean-84954

    05/14/2023, 11:06 PM
    @tall-teacher-57409
  • h

    hallowed-ocean-84954

    05/14/2023, 11:11 PM
    So the basic issue is that the pointAt() method isn't working with the parameters you are using. I couldn't figure out the correct parameters so I just plugged in my own createLookAtMatrix() method which is written directly based on DeVries. Now it all works. I tweaked the key handling on the way past based on the Lime samples - note that it now uses arrow keys because that's what the sample does. If you want WASD it should be trivial to add back. I also based the deltatime on the update() method. I tried a lot of things and was clutching at straws so obviously some of these changes are not required but I didn't rip everything out either. Anyhow like I said, it was the lookat matrix. Enjoy.
  • t

    tall-teacher-57409

    05/15/2023, 5:31 AM
    yep I can see the issues now, sorry if you wasted time spotting them 😅 , but thank you very very very much 🙏
  • p

    powerful-smartphone-79287

    05/15/2023, 8:02 AM
    is it possible to change / make the right click context menu show with custom options
  • p

    powerful-smartphone-79287

    05/15/2023, 8:02 AM
    like is it possible to even have a context menu
  • t

    tall-teacher-57409

    05/15/2023, 8:28 AM
    anything is possible
  • p

    powerful-smartphone-79287

    05/15/2023, 8:41 AM
    is it possible in lime though
  • t

    tall-teacher-57409

    05/15/2023, 8:59 AM
    of course
  • p

    powerful-smartphone-79287

    05/15/2023, 9:01 AM
    do you lnow how to do it
  • p

    powerful-smartphone-79287

    05/15/2023, 9:02 AM
    in either openfl or lime i dont mind
1...131132133...138Latest