Implementing basic physics

This commit is contained in:
Dynamitos committed 2022-11-29 16:34:42 +01:00
1 parent 3d3e264867
commit 1e04da963d
39 files changed
+1999 -145

No files matched your search

+26
View File
@@ -4,31 +4,57 @@ using namespace Seele::Component;
DEFINE_COMPONENT(Transform)
void Transform::setPosition(Math::Vector pos)
{
transform.setPosition(pos);
dirty = true;
}
void Transform::setRotation(Math::Quaternion quat)
{
transform.setRotation(quat);
dirty = true;
}
void Transform::setScale(Math::Vector scale)
{
transform.setScale(scale);
dirty = true;
}
void Transform::setRelativeLocation(Math::Vector location)
{
transform = Math::Transform(location, transform.getRotation(), transform.getScale());
dirty = true;
}
void Transform::setRelativeRotation(Math::Vector rotation)
{
transform = Math::Transform(transform.getPosition(), Math::Quaternion(rotation), transform.getScale());
dirty = true;
}
void Transform::setRelativeRotation(Math::Quaternion rotation)
{
transform = Math::Transform(transform.getPosition(), rotation, transform.getScale());
dirty = true;
}
void Transform::setRelativeScale(Math::Vector scale)
{
transform = Math::Transform(transform.getPosition(), transform.getRotation(), scale);
dirty = true;
}
void Transform::addRelativeLocation(Math::Vector translation)
{
transform = Math::Transform(transform.getPosition() + translation, transform.getRotation(), transform.getScale());
dirty = true;
}
void Transform::addRelativeRotation(Math::Vector rotation)
{
transform = Math::Transform(transform.getPosition(), transform.getRotation() * Math::Quaternion(rotation), transform.getScale());
dirty = true;
}
void Transform::addRelativeRotation(Math::Quaternion rotation)
{
transform = Math::Transform(transform.getPosition(), transform.getRotation() * rotation, transform.getScale());
dirty = true;
}