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

RigidBody::raycast gives incorrect result in raycastInfo for body with multiple colliders + solution #359

Open
VitorioK opened this issue Sep 30, 2023 · 1 comment
Assignees

Comments

@VitorioK
Copy link

bool isHit = body->raycast(ray, raycastInfo); - gives incorrect results in raycastInfo

Solution
File: Collider.cpp
Wrap results calculation in if(...) {}:
bool Collider::raycast(const Ray& ray, RaycastInfo& raycastInfo) {
...
// Convert the raycast info into world-space
if (isHit)
{
raycastInfo.worldPoint = localToWorldTransform * raycastInfo.worldPoint;
raycastInfo.worldNormal = localToWorldTransform.getOrientation() * raycastInfo.worldNormal;
raycastInfo.worldNormal.normalize();
}
...
}

@VitorioK VitorioK changed the title RigidBody::raycast incorrect result in raycastInfo + solution RigidBody::raycast gives incorrect result in raycastInfo for body with multiply colliders + solution Sep 30, 2023
@VitorioK VitorioK changed the title RigidBody::raycast gives incorrect result in raycastInfo for body with multiply colliders + solution RigidBody::raycast gives incorrect result in raycastInfo for body with multiple colliders + solution Sep 30, 2023
@DanielChappuis
Copy link
Owner

Hello. Thanks for your feedback.
I am not sure I understand. Do you mean that the Body::raycast() method returns the raycast result in local-space of the body instead of world-space?

@DanielChappuis DanielChappuis self-assigned this Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants