mardi 14 juin 2016

How to multiply a glm::vec2 with a float in a single step?


When I try to multiply a vec2 with a float in one step like this:

particle.pos += particle.velocity * deltaTime;

it gives the error:

use of overloaded operator '*' is ambiguous (with operand types 'glm::vec2' (aka 'tvec2<float, highp>') and float

However when I do each x and y manually like this

particle.pos.x += particle.velocity.x * deltaTime;
particle.pos.y += particle.velocity.y * deltaTime;

it works fine. I can't figure out why. What am I doing wrong? Shouldn't I be able to multiply it in one step?


Aucun commentaire:

Enregistrer un commentaire