Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[godobject] does iteratevely updating godobject based on perpendicular vector of edge work? #315

Open
JotaroS opened this issue Jul 8, 2020 · 0 comments
Assignees
Labels
firmware question Further information is requested wat wat

Comments

@JotaroS
Copy link
Collaborator

JotaroS commented Jul 8, 2020

question

I see that in the code it's iteratevely calculating next new godobject position by using two normal vector of concave corner.
This will work when corner is acute, but not when corner is shallow. I'm looking at this line:

if (foundCollision)
{
m_processingObstacleCollision = true;
auto perpendicular = Vector2D(
-closestEdgeFirstMinusSecond.y,
closestEdgeFirstMinusSecond.x);
auto resolveRatio =
-Vector2D::determinant(
closestEdgeFirstMinusSecond,
closestEdgeFirst - targetPoint) /
Vector2D::determinant(
closestEdgeFirstMinusSecond,
perpendicular);
auto resolveVec = perpendicular * resolveRatio;
auto resolveLength = resolveVec.length();
targetPoint = targetPoint - (resolveVec * ((resolveLength + c_resolveDistance) / resolveLength));
// update possible collisions
m_possibleCollisions->clear();
m_hashtable.getPossibleCollisions(
Edge(m_position, targetPoint), m_possibleCollisions);
}

here's how it won't work. maybe @lukaswagner can point me out if i'm right or not?

IMG_1612

possible solution

@JotaroS JotaroS added question Further information is requested firmware wat wat labels Jul 8, 2020
@JotaroS JotaroS self-assigned this Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
firmware question Further information is requested wat wat
Projects
None yet
Development

No branches or pull requests

1 participant