52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
#include "../headers/torso.hpp"
|
|
|
|
Torso::Torso(rb::Vector3 coords, _Float16 mass){
|
|
rb::Vector3 com = {torso_Dim.x/2, torso_Dim.y/2, torso_Dim.z/2};
|
|
body = rb::rigidbody(coords,com, mass);
|
|
color = torso_Col;
|
|
globalPos = {0,0,0};
|
|
|
|
initialize_shapes(torso_Dim);
|
|
}
|
|
|
|
Torso::~Torso(){
|
|
delete shapeXZ;
|
|
delete shapeYZ;
|
|
}
|
|
|
|
void Torso::update(sf::Clock cl){
|
|
|
|
}
|
|
|
|
sf::Shape* Torso::draw(ReferencePlane plane){
|
|
|
|
rb::Vector3 tmpRot = body.getRot();
|
|
rb::Vector3 tmpPos = body.getPos();
|
|
|
|
|
|
switch (plane)
|
|
{
|
|
case ReferencePlane::XZ: case ReferencePlane::XZN:
|
|
{
|
|
sf::Shape* shape = shapeXZ;
|
|
shape->setRotation(sf::Angle(sf::radians(tmpRot[1])));
|
|
shape->setPosition({tmpPos[0]+globalPos[0],tmpPos[2]+globalPos[2]});
|
|
shape->setFillColor(color*sf::Color(255,255,255,transparency*255));
|
|
return shape;}
|
|
break;
|
|
|
|
case ReferencePlane::YZ:
|
|
{
|
|
sf::Shape* shape = shapeYZ;
|
|
shape->setRotation(sf::Angle(sf::radians(tmpRot[0])));
|
|
shape->setPosition({tmpPos[1]+globalPos[1],tmpPos[2]+globalPos[2]});
|
|
shape->setFillColor(color*sf::Color(255,255,255,transparency*255));
|
|
return shape;}
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return nullptr;
|
|
} |