mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 20:02:40 +01:00
Update pickup frame position
This commit is contained in:
parent
a3e924ff3c
commit
8af04b48cf
@ -276,6 +276,7 @@ PickupObject::PickupObject(GameWorld* world, const glm::vec3& position,
|
||||
auto atomic = modelData->getAtomic(0)->clone();
|
||||
atomic->setFrame(std::make_shared<ModelFrame>());
|
||||
setModel(std::move(atomic));
|
||||
updateTransform(getPosition(), getRotation());
|
||||
}
|
||||
|
||||
PickupObject::~PickupObject() {
|
||||
@ -318,6 +319,12 @@ void PickupObject::tick(float dt) {
|
||||
glm::vec4(red / 255.f, green / 255.f, blue / 255.f, 1.f) * colourValue;
|
||||
|
||||
if (m_enabled) {
|
||||
static constexpr float kRotationSpeedCoeff = 3.0f;
|
||||
updateTransform(
|
||||
getPosition(),
|
||||
glm::angleAxis(engine->getGameTime() * kRotationSpeedCoeff,
|
||||
glm::vec3(0.f, 0.f, 1.f)));
|
||||
|
||||
// Sort out interactions with things that may or may not be players.
|
||||
btManifoldArray manifoldArray;
|
||||
btBroadphasePairArray& pairArray =
|
||||
|
@ -307,14 +307,8 @@ void ObjectRenderer::renderVehicle(VehicleObject* vehicle,
|
||||
|
||||
void ObjectRenderer::renderPickup(PickupObject* pickup, RenderList& outList) {
|
||||
if (!pickup->isEnabled()) return;
|
||||
|
||||
static constexpr float kRotationSpeedCoeff = 3.0f;
|
||||
glm::mat4 modelMatrix =
|
||||
glm::translate(glm::mat4(1.0f), pickup->getPosition());
|
||||
modelMatrix = glm::rotate(modelMatrix, m_world->getGameTime() * kRotationSpeedCoeff,
|
||||
glm::vec3(0.f, 0.f, 1.f));
|
||||
const auto& atomic = pickup->getAtomic();
|
||||
renderAtomic(atomic.get(), modelMatrix, nullptr, outList);
|
||||
renderAtomic(atomic.get(), glm::mat4(1.f), nullptr, outList);
|
||||
}
|
||||
|
||||
void ObjectRenderer::renderCutsceneObject(CutsceneObject* cutscene,
|
||||
|
Loading…
Reference in New Issue
Block a user