RavEngine
Loading...
Searching...
No Matches
Constraint.hpp
1#pragma once
2#include "ComponentWithOwner.hpp"
3#include "ComponentHandle.hpp"
4#include "Queryable.hpp"
5
6namespace RavEngine{
7
11struct ConstraintTarget : public ComponentWithOwner, public Queryable<ConstraintTarget> {
12 friend class Constraint;
14 void Destroy();
15private:
16 // stores the list of entities that are targeting the owner of this component
17 UnorderedSet<Entity> targeters;
18
23 void DeleteTargeter(decltype(targeters)::value_type source){
24 targeters.erase(source);
25 }
26
31 void AddTargeter(decltype(targeters)::value_type source){
32 targeters.insert(source);
33 }
34};
35
39class Constraint : public ComponentWithOwner, public Queryable<Constraint>{
40 friend class ConstraintTarget;
41protected:
42 // the target the owner is bound to
44 float influence = 1.0;
45public:
46 Constraint(Entity, decltype(target));
47 // invoked by the world on component removal or owner destruction, do not invoke manually
48 void Destroy();
49 auto GetTarget() const { return target; }
50 inline operator bool() const{
51 return target;
52 }
53};
54
55struct SocketConstraint : public Constraint, public QueryableDelta<Constraint,SocketConstraint>{
56 using QueryableDelta<Constraint,SocketConstraint>::GetQueryTypes;
57 std::string boneTarget;
58 SocketConstraint(Entity id, decltype(target), const decltype(boneTarget)& );
59};
60
65 void operator()(const SocketConstraint&, Transform&);
66};
67}
Definition ComponentWithOwner.hpp:6
Definition Constraint.hpp:39
Definition concurrentqueue.h:747
Definition Animation.hpp:6
Definition Constraint.hpp:11
Definition Entity.hpp:11
Definition Queryable.hpp:38
Definition Queryable.hpp:21
Definition Constraint.hpp:55
Definition Constraint.hpp:64
Definition Transform.hpp:20