RigidBodyCollider3.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: RigidBodyCollider3.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: 3-D rigid body collider class.
6 > Created Time: 2017/06/23
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_RIGID_BODY_COLLIDER3_H
10 #define CUBBYFLOW_RIGID_BODY_COLLIDER3_H
11 
13 
14 namespace CubbyFlow
15 {
22  class RigidBodyCollider3 final : public Collider3
23  {
24  public:
25  class Builder;
26 
29 
32 
34  explicit RigidBodyCollider3(const Surface3Ptr& surface);
35 
37  RigidBodyCollider3(const Surface3Ptr& surface,
39 
41  Vector3D VelocityAt(const Vector3D& point) const override;
42 
44  static Builder GetBuilder();
45  };
46 
48  using RigidBodyCollider3Ptr = std::shared_ptr<RigidBodyCollider3>;
49 
54  {
55  public:
57  Builder& WithSurface(const Surface3Ptr& surface);
58 
61 
64 
66  RigidBodyCollider3 Build() const;
67 
70 
71  private:
72  Surface3Ptr m_surface;
73  Vector3D m_linearVelocity{ 0, 0, 0 };
74  Vector3D m_angularVelocity{ 0, 0, 0 };
75  };
76 }
77 
78 #endif
3-D vector class.
Definition: Vector3.h:26
Vector3D VelocityAt(const Vector3D &point) const override
Returns the velocity of the collider at given point.
Builder & WithAngularVelocity(const Vector3D &angularVelocity)
Returns builder with angular velocity.
static Builder GetBuilder()
Returns builder fox RigidBodyCollider3.
Definition: pybind11Utils.h:24
std::shared_ptr< Surface3 > Surface3Ptr
Shared pointer for the Surface3 type.
Definition: Surface3.h:100
RigidBodyCollider3(const Surface3Ptr &surface)
Constructs a collider with a surface.
Vector3D linearVelocity
Linear velocity of the rigid body.
Definition: RigidBodyCollider3.h:25
Builder & WithSurface(const Surface3Ptr &surface)
Returns builder with surface.
3-D rigid body collider class.
Definition: RigidBodyCollider3.h:22
RigidBodyCollider3Ptr MakeShared() const
Builds shared pointer of RigidBodyCollider3 instance.
Builder & WithLinearVelocity(const Vector3D &linearVelocity)
Returns builder with linear velocity.
std::shared_ptr< RigidBodyCollider3 > RigidBodyCollider3Ptr
Shared pointer for the RigidBodyCollider3 type.
Definition: RigidBodyCollider3.h:48
Front-end to create RigidBodyCollider3 objects step by step.
Definition: RigidBodyCollider3.h:53
Abstract base class for generic collider object.
Definition: Collider3.h:27
RigidBodyCollider3 Build() const
Builds RigidBodyCollider3.
Vector3D angularVelocity
Angular velocity of the rigid body.
Definition: RigidBodyCollider3.h:31