Started fixing texture tool (incomplete)
This commit is contained in:
@ -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);
|
||||
}
|
Reference in New Issue
Block a user