Cogs.Core
ConstraintComponent.h
1#pragma once
2
3#include "EntityDefinition.h"
4
5#include "Foundation/ComponentModel/Component.h"
6
7#include <glm/vec3.hpp>
8
9namespace Cogs
10{
11 namespace Core
12 {
14 {
15 public:
16 static void registerType();
17
20 };
21
23 {
24 public:
25 static void registerType();
26 };
27
29 {
30 public:
31 static void registerType();
32
33 glm::vec3 anchor;
34 glm::vec3 targetAnchor;
35
36 glm::vec3 axis = glm::vec3(0, 0, 1);
37 glm::vec3 targetAxis = glm::vec3(0, 0, 1);
38 };
39
41 {
42 public:
43 static void registerType();
44
45 glm::vec3 anchor;
46 glm::vec3 targetAnchor;
47
48 float stiffness = 10.0f;
49 float damping = 0.1f;
50 };
51
53 {
54 public:
55 static void registerType();
56
57 glm::vec3 anchor;
58 glm::vec3 targetAnchor;
59 };
60 }
61}
62
63template<> inline Cogs::StringView getName<Cogs::Core::ConstraintComponent>() { return "ConstraintComponent"; }
64template<> inline Cogs::StringView getName<Cogs::Core::FixedConstraintComponent>() { return "FixedConstraintComponent"; }
65template<> inline Cogs::StringView getName<Cogs::Core::HingeConstraintComponent>() { return "HingeConstraintComponent"; }
66template<> inline Cogs::StringView getName<Cogs::Core::SpringConstraintComponent>() { return "SpringConstraintComponent"; }
67template<> inline Cogs::StringView getName<Cogs::Core::GenericConstraintComponent>() { return "GenericConstraintComponent"; }
Base class for Component instances.
Definition: Component.h:143
EntityPtr target
Target entity. Constraint is created between owner of this component and target.
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
std::shared_ptr< ComponentModel::Entity > EntityPtr
Smart pointer for Entity access.
Definition: EntityPtr.h:12
Contains all Cogs related functionality.
Definition: FieldSetter.h:23