Started fixing texture tool (incomplete)

This commit is contained in:
2023-04-02 17:15:49 -07:00
parent 7cb9846e1b
commit b3f58ed0ec
14 changed files with 304 additions and 11 deletions

View File

@ -14,6 +14,8 @@ CharacterController2D::CharacterController2D(SceneItem *i) :
void CharacterController2D::onStart() {
useEvent([&](float_t delta){
if(velocity == glm::vec2(0, 0)) return;
// Common variables
auto myCollider = item->getComponent<Collider2D>();
@ -62,11 +64,6 @@ void CharacterController2D::onStart() {
}
}
// if(
// mathAbs<float_t>(moveAmount.x) <= 0.001f &&
// mathAbs<float_t>(moveAmount.y) <= 0.001f
// ) return;
transform->setLocalPosition(
transform->getLocalPosition() + (glm::vec3(moveAmount.x, 0, moveAmount.y) * delta)
);
@ -83,5 +80,8 @@ void CharacterController2D::onStart() {
}
}
// Stop velocity near zero.
if(mathAbs<float_t>(velocity.x) <= 0.001f) velocity.x = 0;
if(mathAbs<float_t>(velocity.y) <= 0.001f) velocity.y = 0;
}, getScene()->eventSceneUpdate);
}