Skip to content

Commit

Permalink
stash, play layer not working
Browse files Browse the repository at this point in the history
  • Loading branch information
adafcaefc committed Dec 5, 2024
1 parent eada277 commit c260572
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions Geome3Dash/src/game/editor/CameraKeyframeEditorPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,8 @@ namespace g3d
return true;
}



void CameraKeyframeEditorPopup::onClose(CCObject* obj) {
if (ckel->keyframeBuffer.keyframes.empty()) { ckel->keyframeBuffer.setKeyframe(0, glm::vec3(0), glm::vec3(0)); }
currentLevelData.keyframe = ckel->keyframeBuffer;
setLevelData(LevelEditorLayer::get(), currentLevelData);
this->setMouseEnabled(false);
Expand Down
2 changes: 1 addition & 1 deletion Geome3Dash/src/helper/CameraKeyframeBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace g3d
}

void CameraKeyframeBuffer::removeLastKeyframe() {
keyframes.pop_back();
if (keyframes.size()) { keyframes.pop_back(); }
}

CameraKeyframe CameraKeyframeBuffer::getInterpolatedCameraKeyframe(float playersXpos) {
Expand Down
4 changes: 2 additions & 2 deletions Geome3Dash/src/transformer/SplineGameObjectTransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace g3d
void SplineGameObjectTransformer::transform(GameObjectModel* gom)
{
auto block = gom->getGameObject();
auto data = spline->findClosestByLength(block->getPositionX() * *lengthScaleFactor);
auto data = spline->findClosestByLength(block->m_positionX * (*lengthScaleFactor));

auto pos = data.value;
auto normal = glm::normalize(spline->normal(data.t));
Expand All @@ -30,7 +30,7 @@ namespace g3d
glm::quat rotationQuat = glm::quat_cast(rotationMatrix);
glm::vec3 eulerDegrees = glm::degrees(glm::eulerAngles(rotationQuat * firstRotationQuat));

gom->setPosition(pos + (normal * (*lengthScaleFactor) * (block->getPositionY() - 110)));
gom->setPosition(pos + (normal * (*lengthScaleFactor) * (static_cast<float>(block->m_positionY) - 110)));
gom->setRotation(eulerDegrees);
gom->setScale(glm::vec3(
0.5 * (block->m_startFlipX ? -1 : 1) * (*lengthScaleFactor) * 30,
Expand Down
12 changes: 6 additions & 6 deletions Geome3Dash/src/transformer/SplinePlayerObjectTransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ namespace g3d
{
if (auto pom = dynamic_cast<PlayerObjectModel*>(gom))
{
auto block = gom->getGameObject();
auto data = spline->findClosestByLength(block->getPositionX() * *lengthScaleFactor);
auto player = pom->getPlayerObject();
auto data = spline->findClosestByLength(player->m_position.x * (*lengthScaleFactor));

auto pos = data.value;
auto normal = glm::normalize(spline->normal(data.t));
auto tangent = glm::normalize(spline->tangent(data.t));

glm::vec3 side(1.f, 0.f, 0.f);
float normalDeltaAngle = glm::radians(block->getRotation());
float normalDeltaAngle = glm::radians(player->getRotation());

glm::quat firstRotationQuat = glm::angleAxis(normalDeltaAngle, side);

Expand All @@ -34,11 +34,11 @@ namespace g3d

float scale = pom->getPlayerObject()->getScale();

gom->setPosition(pos + (normal * (*lengthScaleFactor) * (block->getPositionY() - 110)));
gom->setPosition(pos + (normal * (*lengthScaleFactor) * (player->m_position.y - 110)));
gom->setRotation(eulerDegrees);
gom->setScale(glm::vec3(
0.5 * (block->m_startFlipX ? -1 : 1) * (*lengthScaleFactor) * 30,
0.5 * (block->m_startFlipY ? -1 : 1) * (*lengthScaleFactor) * 30 * scale,
0.5 * (player->m_startFlipX ? -1 : 1) * (*lengthScaleFactor) * 30,
0.5 * (player->m_startFlipY ? -1 : 1) * (*lengthScaleFactor) * 30 * scale,
0.5 * (*lengthScaleFactor) * 30 * scale));
}
}
Expand Down

0 comments on commit c260572

Please sign in to comment.