A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
/**
* @file Velocity.hpp
* @brief Velocity component for physics simulation
* @details Provides Velocity component for linear and angular motion.
*
* @author ESEngine Team
* @date 2026
*
* @copyright Copyright (c) 2026 ESEngine Team
* Licensed under the Apache License, Version 2.0.
*/
#pragma once
// =============================================================================
// Includes
// =============================================================================
#include "../../core/Types.hpp"
#include "../../core/Reflection.hpp"
#include "../../math/Math.hpp"
namespace esengine::ecs {
// =============================================================================
// Velocity Component
// =============================================================================
/**
* @brief Velocity component for simple kinematic motion
*
* @details Stores linear and angular velocity. The SDK's VelocitySystem
* integrates it into Transform every Update in play mode; entities
* owned by the physics solver (RigidBody2D) are skipped so the two
* never double-move an entity.
*
* @note Angular velocity is in radians per second around each axis.
*/
ES_COMPONENT()
struct Velocity {
/** @brief Linear velocity (units per second) */
ES_PROPERTY(replicated)
glm::vec3 linear{0.0f};
/** @brief Angular velocity (radians per second) */
ES_PROPERTY(replicated)
glm::vec3 angular{0.0f};
/** @brief Default constructor (zero velocity) */
Velocity() = default;
/**
* @brief Constructs with linear velocity only
* @param lin Linear velocity vector
*/
explicit Velocity(const glm::vec3& lin) : linear(lin) {}
/**
* @brief Constructs with both linear and angular velocity
* @param lin Linear velocity vector
* @param ang Angular velocity vector
*/
Velocity(const glm::vec3& lin, const glm::vec3& ang) : linear(lin), angular(ang) {}
};
} // namespace esengine::ecs