Add an AvoidCollisionWithLookAt curve

Same path as AvoidCollision, but with lookat rotation instead of slerp. Useful (needed) for some cases in the interactive installations, but should be replaced later on as it leads to fast rotations
This commit is contained in:
Emma Broman
2021-08-13 15:55:06 +02:00
parent 1765296e5b
commit 4ccc47161c
3 changed files with 11 additions and 2 deletions

View File

@@ -42,7 +42,13 @@ public:
enum CurveType {
AvoidCollision,
Linear,
ZoomOutOverview
ZoomOutOverview,
AvoidCollisionWithLookAt // @TODO (2021-08-13, emmbr) This type right now leads
// to rapid rotations, but is useful in specific
// scenarios, e.g. close to surfaces. Later we want to
// remove it, and create a curve type that looks nicely
// at the targets when moving, avoids collisions and
// doesn't introduce sudden large changes in rotation
};
Path(Waypoint start, Waypoint end, CurveType type,

View File

@@ -93,6 +93,7 @@ Path::Path(Waypoint start, Waypoint end, CurveType type,
{
switch (_curveType) {
case CurveType::AvoidCollision:
case CurveType::AvoidCollisionWithLookAt:
_curve = std::make_unique<AvoidCollisionCurve>(_start, _end);
break;
case CurveType::Linear:
@@ -174,6 +175,7 @@ glm::dquat Path::interpolateRotation(double t) const {
case CurveType::Linear:
return easedSlerpRotation(t);
case CurveType::ZoomOutOverview:
case CurveType::AvoidCollisionWithLookAt:
return lookAtTargetsRotation(t);
default:
throw ghoul::MissingCaseException();

View File

@@ -105,7 +105,8 @@ PathNavigator::PathNavigator()
_defaultCurveOption.addOptions({
{ Path::CurveType::AvoidCollision, "AvoidCollision" },
{ Path::CurveType::Linear, "Linear" },
{ Path::CurveType::ZoomOutOverview, "ZoomOutOverview"}
{ Path::CurveType::ZoomOutOverview, "ZoomOutOverview"},
{ Path::CurveType::AvoidCollisionWithLookAt, "AvoidCollisionWithLookAt"}
});
addProperty(_defaultCurveOption);