Skip to content

Why is matrix multiplication backwards ? #182

@karshan

Description

@karshan

The implementation in https://github.com/deltaphc/raylib-rs/blob/master/raylib/src/core/math.rs#L1901 is backwards. (i.e. if you want to compute a * b, you need to use the expression b * a when using raylib-rs)

e.g.

A = [ 1, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0 ] // (m0 = 1; all other m_ = 0)

B = [ 0, 0, 0, 0,
1, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0 ] // (m1 = 1; all other m_ = 0)

Then in raylib-rs A * B = B; but A * B should = 0 (the zero matrix).

I'm assuming m1 is representing row 1 column 0 based on the implementation of Matrix::translate()

(this is also true in raylib so maybe this might not be considered a bug, raysan5/raylib#3039, but the rotate_x/y/z are inconsistent with raylib)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions