mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2025-06-20 03:36:37 +02:00
remove old transform and velocity components and replace with new decomposed components
focus on 2D for now
This commit is contained in:
@ -6,22 +6,13 @@
|
||||
|
||||
namespace MM::Systems {
|
||||
|
||||
void player_velocity2d(entt::view<entt::get_t<MM::Input::PlayerID, MM::Components::Velocity2D>> view, const MM::Engine* engine) {
|
||||
void player_velocity2d(entt::view<entt::get_t<const MM::Input::PlayerID, MM::Components::Velocity2DPositionIntent>> view, const MM::Engine* engine) {
|
||||
ZoneScopedN("MM::Systems::PlayerVelocity2D");
|
||||
|
||||
auto& input_ss = engine->getService<MM::Services::InputService>();
|
||||
|
||||
view.each([&input_ss](const MM::Input::PlayerID p_id, MM::Components::Velocity2D& v) {
|
||||
//const float movement_speed = 8.f; // apply via post processing
|
||||
|
||||
auto vec_force = input_ss.getMoveForce(p_id);
|
||||
|
||||
if (vec_force >= 0.01f) {
|
||||
v.velocity = input_ss.getMoveVec(p_id);
|
||||
//v.velocity *= vec_force;
|
||||
} else {
|
||||
v.velocity = {0.f, 0.f};
|
||||
}
|
||||
view.each([&input_ss](const MM::Input::PlayerID p_id, MM::Components::Velocity2DPositionIntent& v) {
|
||||
v.intent = input_ss.getMoveVec(p_id);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <mm/engine_fwd.hpp>
|
||||
#include <entt/entity/utility.hpp>
|
||||
#include <mm/services/input_service.hpp>
|
||||
#include <mm/components/velocity2d.hpp>
|
||||
#include <mm/components/velocity2d_position_intent.hpp>
|
||||
|
||||
namespace MM::Systems {
|
||||
|
||||
// this system transforms the input from the input_service into velocity
|
||||
void player_velocity2d(entt::view<entt::get_t<MM::Input::PlayerID, MM::Components::Velocity2D>> view, const MM::Engine* engine);
|
||||
// this system transforms the input from the input_service into velocity intent
|
||||
void player_velocity2d(entt::view<entt::get_t<const MM::Input::PlayerID, MM::Components::Velocity2DPositionIntent>> view, const MM::Engine* engine);
|
||||
|
||||
} // MM::Systems
|
||||
|
||||
|
Reference in New Issue
Block a user