1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#include "Physics/BsCollider.h"
4#include "Physics/BsCollider.h"
5#include "Physics/BsFCollider.h"
6#include "Math/BsRay.h"
7#include "Physics/BsPhysics.h"
8
9namespace bs
10{
11 Vector3 Collider::getPosition() const
12 {
13 return mInternal->getPosition();
14 }
15
16 Quaternion Collider::getRotation() const
17 {
18 return mInternal->getRotation();
19 }
20
21 void Collider::setTransform(const Vector3& pos, const Quaternion& rot)
22 {
23 mInternal->setTransform(pos, rot);
24 }
25
26 void Collider::setScale(const Vector3& scale)
27 {
28 mScale = scale;
29 }
30
31 Vector3 Collider::getScale() const
32 {
33 return mScale;
34 }
35
36 void Collider::setIsTrigger(bool value)
37 {
38 mInternal->setIsTrigger(value);
39 }
40
41 bool Collider::getIsTrigger() const
42 {
43 return mInternal->getIsTrigger();
44 }
45
46 void Collider::setRigidbody(Rigidbody* value)
47 {
48 mInternal->setIsStatic(value == nullptr);
49
50 mRigidbody = value;
51 }
52
53 void Collider::setMass(float mass)
54 {
55 mInternal->setMass(mass);
56 }
57
58 float Collider::getMass() const
59 {
60 return mInternal->getMass();
61 }
62
63 void Collider::setMaterial(const HPhysicsMaterial& material)
64 {
65 mInternal->setMaterial(material);
66 }
67
68 HPhysicsMaterial Collider::getMaterial() const
69 {
70 return mInternal->getMaterial();
71 }
72
73 void Collider::setContactOffset(float value)
74 {
75 mInternal->setContactOffset(value);
76 }
77
78 float Collider::getContactOffset()
79 {
80 return mInternal->getContactOffset();
81 }
82
83 void Collider::setRestOffset(float value)
84 {
85 mInternal->setRestOffset(value);
86 }
87
88 float Collider::getRestOffset()
89 {
90 return mInternal->getRestOffset();
91 }
92
93 void Collider::setLayer(UINT64 layer)
94 {
95 mInternal->setLayer(layer);
96 }
97
98 UINT64 Collider::getLayer() const
99 {
100 return mInternal->getLayer();
101 }
102
103 void Collider::setCollisionReportMode(CollisionReportMode mode)
104 {
105 mInternal->setCollisionReportMode(mode);
106 }
107
108 CollisionReportMode Collider::getCollisionReportMode() const
109 {
110 return mInternal->getCollisionReportMode();
111 }
112
113 bool Collider::rayCast(const Ray& ray, PhysicsQueryHit& hit, float maxDist) const
114 {
115 return gPhysics()._rayCast(ray.getOrigin(), ray.getDirection(), *this, hit, maxDist);
116 }
117
118 bool Collider::rayCast(const Vector3& origin, const Vector3& unitDir, PhysicsQueryHit& hit, float maxDist) const
119 {
120 return gPhysics()._rayCast(origin, unitDir, *this, hit, maxDist);
121 }
122}