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

    tall-teacher-57409

    05/24/2023, 7:56 AM
    ugh something's wrong here

    https://cdn.discordapp.com/attachments/769686258049351722/1110838659336392724/Peek_2023-05-24_09-54.gif▾

  • t

    tall-teacher-57409

    05/24/2023, 7:56 AM
    pressing left goes right
  • t

    tall-teacher-57409

    05/24/2023, 7:56 AM
    idk and other weird stuff
  • t

    tall-teacher-57409

    05/24/2023, 7:56 AM
    can't figure it out
  • h

    hallowed-ocean-84954

    05/24/2023, 1:33 PM
    de Vries comments at one point on the moving of an object in one direction being the same as moving the camera in another. But I don't know if that's the kind of matrix transform issue you have here or if you just have the matrix being constructed with the wrong direction. There is also the possibility of having a direction vector facing the wrong way. Is this from de Vries or something else you are working on ? I don't recognise this example.
  • t

    tall-teacher-57409

    05/24/2023, 1:56 PM
    yeah its from deVries
  • t

    tall-teacher-57409

    05/24/2023, 3:45 PM
    I also copied almost everything from your rubiks cube sample lol I love the modularity
  • t

    tall-teacher-57409

    05/24/2023, 3:46 PM
    I'm in the lightning chapter, but decided to refactor things to make life easier for me, the cube is rendered fine butttt the camera is not right as you see
  • t

    tall-teacher-57409

    05/24/2023, 7:50 PM
    ok after some debugging, im pretty sure something's up with my lookat/view matrix
  • t

    tall-teacher-57409

    05/24/2023, 7:50 PM
    or the onMouseMove movement itself
  • t

    tall-teacher-57409

    05/24/2023, 7:56 PM
    shit I'm lost, I'll try again tmr 😭
  • t

    tall-teacher-57409

    05/24/2023, 7:56 PM
    it just looks right
  • h

    hallowed-ocean-84954

    05/25/2023, 2:46 AM
    It's like the cube is looking at the mouse position. When it moves off screen to the left are holding the right arrow key ?
  • h

    hallowed-ocean-84954

    05/25/2023, 3:27 AM
    Are you trying to use the mouse to rotate the cube ?
  • t

    tall-teacher-57409

    05/25/2023, 3:29 AM
    noo, I'm just doing exactly like what the author was doing in the tutorials
  • h

    hallowed-ocean-84954

    05/25/2023, 3:30 AM
    Ah ok, hmm. So the camera should look toward the mouse pointer ?
  • t

    tall-teacher-57409

    05/25/2023, 3:31 AM
    typically, yeah
  • t

    tall-teacher-57409

    05/25/2023, 3:31 AM
    but it's strange
  • t

    tall-teacher-57409

    05/25/2023, 3:33 AM
    you see how moving the camera looks normal here, its like the camera is moving not the cube

    https://cdn.discordapp.com/attachments/769686258049351722/1111134979024502825/Peek_2023-05-25_05-32.gif▾

  • t

    tall-teacher-57409

    05/25/2023, 3:34 AM
    and all what I did is refactor this sample
  • t

    tall-teacher-57409

    05/25/2023, 3:34 AM
    to this
  • h

    hallowed-ocean-84954

    05/25/2023, 3:34 AM
    Oh hang on. How much of the cube code did you take ? I do have a mode where I use the mouse to rotate the cube.
  • t

    tall-teacher-57409

    05/25/2023, 3:36 AM
    pretty much the the entire SimpleCubeProgram.hx (I also took Program)
  • t

    tall-teacher-57409

    05/25/2023, 3:36 AM
    MatrixUtils too
  • t

    tall-teacher-57409

    05/25/2023, 3:37 AM
    that's it i think
  • h

    hallowed-ocean-84954

    05/25/2023, 4:06 AM
    None of that should be a problem. The target object is set in the scene
  • t

    tall-teacher-57409

    05/25/2023, 4:37 AM
    dunno will check again
  • t

    tall-teacher-57409

    05/25/2023, 5:07 AM
    Copy code
    hx
    
        public static function onMouseMove(x:Float, y:Float) {
            if (firstMouse) {
                lastX = x;
                lastY = y;
                firstMouse = false;
            }
            sensitivity = 0.1;
            xOffset = x - lastX;
            yOffset = lastY - y;
            lastX = x;
            lastY = y;
            xOffset *= sensitivity;
            yOffset *= sensitivity;
            yaw += xOffset;
            pitch += yOffset;
            if (pitch > 89.0)
                pitch = 89.0;
            if (pitch < -89.0)
                pitch = -89.0;
            var direction:Vector4 = new Vector4();
            direction.x = Math.cos(yaw * Math.PI / 180) * Math.cos(pitch * Math.PI / 180);
            direction.y = Math.sin(pitch * Math.PI / 180);
            direction.z = Math.sin(yaw * Math.PI / 180) * Math.cos(pitch * Math.PI / 180);
            direction.normalize();
            front = direction;
        }
    onMouseMove handler looks fine to me 😭
  • t

    tall-teacher-57409

    05/25/2023, 5:08 AM
    Copy code
    hx
                    view = MatrixUtils.createLookAtMatrix(Camera.pos, Camera.pos.add(Camera.front), new Vector4(0.0, 1.0, 0.0));
    And updating the view matrix like this
  • t

    tall-teacher-57409

    05/25/2023, 5:09 AM
    that's literally everything responsible for yaw/pitch camera movement
1...134135136137138Latest