Capycore Engine  0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
Loading...
Searching...
No Matches
transform.h
Go to the documentation of this file.
1#pragma once
3
4#include <memory>
5#include <optional>
6
22class Transform {
23 private:
24 Vector3 local_position_;
25 float rotation_{};
26 Vector3 scale_;
27 std::optional<std::reference_wrapper<Transform>> parent_;
28
29 public:
34 std::optional<std::reference_wrapper<Transform>> parent);
35
40 [[nodiscard]] Vector3 local_position() const noexcept;
41
47 Transform& local_position(const Vector3& pos) noexcept;
48
53 [[nodiscard]] Vector3 position() const noexcept;
54
60 Transform& position(const Vector3& pos) noexcept;
61
67 Transform& rotation(float rot) noexcept;
68
73 [[nodiscard]] float rotation() const noexcept;
74
81
86 [[nodiscard]] Vector3 scale() const noexcept;
87
94 std::optional<std::reference_wrapper<Transform>> parent) noexcept;
95
100 [[nodiscard]] std::optional<std::reference_wrapper<Transform>> parent()
101 const noexcept;
102};
Represents the position, rotation, and scale of a GameObject in 3D space. The Transform class encapsu...
Definition transform.h:22
float rotation() const noexcept
Get the rotation of the Transform in degrees.
Transform(Vector3 position, float rotation, Vector3 scale)
Transform(Vector3 position, float rotation, Vector3 scale, std::optional< std::reference_wrapper< Transform > > parent)
Vector3 scale() const noexcept
Get the scale of the Transform.
Vector3 local_position() const noexcept
Get the local position of the Transform.
Vector3 position() const noexcept
Get the world position of the Transform.
std::optional< std::reference_wrapper< Transform > > parent() const noexcept
Get the parent Transform.
Transform(Vector3 position)
Represents a 3D vector with x, y, and z components. This class provides basic vector operations such ...
Definition vector3.h:8