Skip to content

Commit

Permalink
Fix player orientation in teleport trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
hhirsch committed May 12, 2018
1 parent 71de0da commit d79dfdf
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions source/trigger/PortalTeleport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,7 @@ void PortalTeleport::setAction(radix::Entity &trigger, const std::string &destin
radix::entities::Player &player = trigger.world.getPlayer();
if (trigger.world.destinations.find(destination) != trigger.world.destinations.end()) {
const radix::Quaternion &destinationOrientation = trigger.world.destinations.at(destination).orientation;
const radix::Quaternion &oldPlayerOrientation = player.getHeadOrientation();

/*
* destinationOrientation : describes the rotation needed to tranform a vector in the
* world coordinates to a vector following the orientation of the destination portal.
*
* oldPlayerOrientation : describes the rotation to transform a reference vector into a vector
* following the player orientation
*
* The product of two quaternions can be seen as the composition of two rotations.
* (all quaternions can be interpreted as a rotation)
*/
radix::Quaternion newPlayerOrientation = destinationOrientation * oldPlayerOrientation;
radix::Quaternion newPlayerOrientation = destinationOrientation;

player.setPosition(trigger.world.destinations.at(destination).position);
player.setOrientation(newPlayerOrientation);
Expand Down

0 comments on commit d79dfdf

Please sign in to comment.