22#include <kiwano-physics/Fixture.h>
43 bool IsTouching()
const;
47 void SetEnabled(
bool flag);
51 bool IsEnabled()
const;
71 void SetFriction(
float friction);
75 float GetFriction()
const;
83 void SetRestitution(
float restitution);
87 float GetRestitution()
const;
91 void ResetRestitution();
95 void SetTangentSpeed(
float speed);
99 float GetTangentSpeed()
const;
103 b2Contact* GetB2Contact()
const;
107 void SetB2Contact(b2Contact* contact);
109 bool operator==(
const Contact& rhs)
const;
110 bool operator!=(
const Contact& rhs)
const;
120 template <
typename _Ty>
124 using iterator_category = std::forward_iterator_tag;
126 using pointer = _Ty*;
127 using reference = _Ty&;
128 using difference_type = ptrdiff_t;
130 IteratorImpl(
const _Ty& elem)
135 inline reference operator*()
const
137 return const_cast<reference
>(elem_);
140 inline pointer operator->()
const
142 return std::pointer_traits<pointer>::pointer_to(**
this);
145 inline IteratorImpl& operator++()
147 elem_.SetB2Contact(elem_.GetB2Contact()->GetNext());
151 inline IteratorImpl operator++(
int)
153 IteratorImpl old = *
this;
158 inline bool operator==(
const IteratorImpl& rhs)
const
160 return elem_ == rhs.elem_;
163 inline bool operator!=(
const IteratorImpl& rhs)
const
165 return !operator==(rhs);
174 using iterator = IteratorImpl<value_type>;
175 using const_iterator = IteratorImpl<const value_type>;
194 inline iterator begin()
196 return iterator(first_);
199 inline const_iterator begin()
const
204 inline const_iterator cbegin()
const
206 return const_iterator(first_);
209 inline iterator end()
214 inline const_iterator end()
const
219 inline const_iterator cend()
const
221 return const_iterator(
Contact());
232 KGE_ASSERT(contact_);
233 return contact_->IsTouching();
238 KGE_ASSERT(contact_);
239 contact_->SetEnabled(flag);
244 KGE_ASSERT(contact_);
245 return contact_->IsEnabled();
250 KGE_ASSERT(contact_);
251 contact_->SetFriction(friction);
256 KGE_ASSERT(contact_);
257 return contact_->GetFriction();
262 KGE_ASSERT(contact_);
263 contact_->ResetFriction();
268 KGE_ASSERT(contact_);
269 contact_->SetRestitution(restitution);
274 KGE_ASSERT(contact_);
275 return contact_->GetRestitution();
280 KGE_ASSERT(contact_);
281 contact_->ResetRestitution();
294inline bool Contact::operator==(
const Contact& rhs)
const
296 return contact_ == rhs.contact_;
299inline bool Contact::operator!=(
const Contact& rhs)
const
301 return contact_ != rhs.contact_;
物理夹具
Definition: Fixture.h:40
物体
Definition: PhysicBody.h:40