Implementing basic physics
This commit is contained in:
@@ -145,14 +145,31 @@ Vector Transform::getScale() const
|
||||
return Vector(scale);
|
||||
}
|
||||
|
||||
void Transform::setPosition(Math::Vector pos)
|
||||
{
|
||||
position = Vector4(pos, 0);
|
||||
}
|
||||
|
||||
void Transform::setRotation(Math::Quaternion quat)
|
||||
{
|
||||
rotation = quat;
|
||||
}
|
||||
|
||||
void Transform::setScale(Math::Vector s)
|
||||
{
|
||||
scale = Vector4(s, 0);
|
||||
}
|
||||
|
||||
Vector Transform::getForward() const
|
||||
{
|
||||
return glm::normalize(Vector(0, 0, 1) * rotation);
|
||||
}
|
||||
|
||||
Vector Transform::getRight() const
|
||||
{
|
||||
return glm::normalize(Vector(1, 0, 0) * rotation);
|
||||
}
|
||||
|
||||
Vector Transform::getUp() const
|
||||
{
|
||||
return glm::normalize(Vector(0, 1, 0) * rotation);
|
||||
|
||||
@@ -25,6 +25,11 @@ public:
|
||||
Vector getPosition() const;
|
||||
Quaternion getRotation() const;
|
||||
Vector getScale() const;
|
||||
|
||||
void setPosition(Math::Vector pos);
|
||||
void setRotation(Math::Quaternion quat);
|
||||
void setScale(Math::Vector scale);
|
||||
|
||||
Vector getForward() const;
|
||||
Vector getRight() const;
|
||||
Vector getUp() const;
|
||||
|
||||
Reference in New Issue
Block a user