I'm converting some C++ and glm code to D and gl3n. And I'm stumped at the following line.

GLboolean CheckCollision(BallObject &one, GameObject &two) // AABB - Circle collision
{
    // Get center point circle first
    glm::vec2 center(one.Position + one.Radius);
    . . .
}

one.Position is a vec2 (x and y) whereas Radius is a GLfloat

// my D code statement

vec2 center2 = one.position + one.radius;   // D code with gl3n

returns Error: incompatible types for ((one.position) + (one.radius)): 'Vector!(float, 2)' and 'float'

I agree with the D code. A vec and scalar can't be added together. So why (or how) is the glm code working?


I looked at https://github.com/g-truc/glm project source, but I'm not even sure where to start?

Thanks

Reply via email to