mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-03 01:59:35 -06:00
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:
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user