allow direct particle position alteration in order for mouse spring work

This commit is contained in:
Irlan 2018-05-30 15:29:45 -03:00
parent caef3fede8
commit 0348d55d21
2 changed files with 12 additions and 1 deletions

View File

@ -168,7 +168,7 @@ public:
if (m_spring)
{
m_particle->ApplyTranslation(dx);
m_particle->SetPosition(B);
}
else
{

View File

@ -81,6 +81,11 @@ public:
// Get the vertex index.
u32 GetVertex() const;
// Set the particle position.
// If the particle is dynamic changing the position directly might lead
// to physically incorrect simulation behaviour.
void SetPosition(const b3Vec3& position);
// Get the particle position.
const b3Vec3& GetPosition() const;
@ -175,6 +180,12 @@ inline u32 b3Particle::GetVertex() const
return m_vertex;
}
inline void b3Particle::SetPosition(const b3Vec3& position)
{
m_position = position;
m_translation.SetZero();
}
inline const b3Vec3& b3Particle::GetPosition() const
{
return m_position;