<commit_before>#ifndef PIXELBOOST_DISABLE_BOX2D

#include "Box2D/Box2D.h"

#include "pixelboost/logic/component/physics/2d/physicsBody.h"
#include "pixelboost/logic/component/transform.h"
#include "pixelboost/logic/message/update.h"
#include "pixelboost/logic/system/physics/2d/physics.h"
#include "pixelboost/logic/entity.h"
#include "pixelboost/logic/scene.h"
#include "pixelboost/physics/2d/helpers.h"

using namespace pb;

PhysicsBody2DComponent::PhysicsBody2DComponent(Entity* parent, BodyType type, BodyShape shape, glm::vec2 size)
    : PhysicsComponent(parent)
{
    pb::PhysicsSystem2D* physicsSystem = GetScene()->GetSystemByType<pb::PhysicsSystem2D>();
    
    b2World* world = physicsSystem->GetPhysicsWorld();
    
    pb::TransformComponent* transform = GetParent()->GetComponentByType<pb::TransformComponent>();
    glm::vec3 position = transform->GetPosition();
    glm::vec3 rotation = transform->GetRotation();
    
    b2BodyDef bodyDefinition;
    bodyDefinition.fixedRotation = false;
    bodyDefinition.position = b2Vec2(position.x, position.y);
    bodyDefinition.angle = rotation.z;
    switch (type)
    {
        case kBodyTypeDynamic:
            bodyDefinition.type = b2_dynamicBody;
            break;
        case kBodyTypeStatic:
            bodyDefinition.type = b2_staticBody;
            break;
        case kBodyTypeKinematic:
            bodyDefinition.type = b2_kinematicBody;<commit_msg>Fix initial rotation on physics body<commit_after>#ifndef PIXELBOOST_DISABLE_BOX2D

#include "Box2D/Box2D.h"

#include "pixelboost/logic/component/physics/2d/physicsBody.h"
#include "pixelboost/logic/component/transform.h"
#include "pixelboost/logic/message/update.h"
#include "pixelboost/logic/system/physics/2d/physics.h"
#include "pixelboost/logic/entity.h"
#include "pixelboost/logic/scene.h"
#include "pixelboost/physics/2d/helpers.h"

using namespace pb;

PhysicsBody2DComponent::PhysicsBody2DComponent(Entity* parent, BodyType type, BodyShape shape, glm::vec2 size)
    : PhysicsComponent(parent)
{
    pb::PhysicsSystem2D* physicsSystem = GetScene()->GetSystemByType<pb::PhysicsSystem2D>();
    
    b2World* world = physicsSystem->GetPhysicsWorld();
    
    pb::TransformComponent* transform = GetParent()->GetComponentByType<pb::TransformComponent>();
    glm::vec3 position = transform->GetPosition();
    glm::vec3 rotation = transform->GetRotation();
    
    b2BodyDef bodyDefinition;
    bodyDefinition.fixedRotation = false;
    bodyDefinition.position = b2Vec2(position.x, position.y);
    bodyDefinition.angle = glm::radians(rotation.z);
    switch (type)
    {
        case kBodyTypeDynamic:
            bodyDefinition.type = b2_dynamicBody;
            break;
        case kBodyTypeStatic:
            bodyDefinition.type = b2_staticBody;
            break;
        case kBodyTypeKinematic:
            bodyDefinition.type = b2_kinematicBody;
{'fraction_non_alphanumeric': 0.11284181377639321, 'fraction_numerical': 0.013845621322256836, 'mean_word_length': 4.106007067137809, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '257344', 'n_tokens_mistral': 910, 'n_tokens_neox': 892, 'n_words': 144}