void RocketLauncher::setupRocket(Rocket* rocket, WorldObject* target) { WorldObject* worldObject = hardpoint()->components()->worldObject(); glm::quat launchOrientation = worldObject->transform().orientation() * GeometryHelper::quatFromViewDirection(hardpoint()->direction()); float rocketLength = rocket->bounds().minimalGridAABB().extent(ZAxis) * rocket->transform().scale(); glm::vec3 rocketPosition = hardpoint()->voxel()->position() + launchOrientation * glm::vec3(0, 0, -rocketLength / 2.0f); rocket->transform().setOrientation(launchOrientation); rocket->transform().setPosition(rocketPosition); rocket->setCreator(worldObject); rocket->setTarget(target); rocket->physics().setSpeed(worldObject->physics().speed()); }