Hi.
I’m using scene.getPhysicsEngine().raycastToRef and raycast “classic” and I always get the same values for hitPoint and hitPointWorld…
I done the test in the playground and same result, maybe I didn’t understand the differences of the two results ?
I suppose it should be hitPoint “local” to other body ?
I look at the source (physicsRaycastResult.ts) and find an explanation :
/**
* Gets the hit point in the world
*/
get hitPointWorld(): Vector3 {
return this._hitPoint;
}
I’m running your PG and get the world coordinate (plus the little sphere) where the ray collision occurs. World position value seems appropriate. Am I missing something?
Sorry my explanations were confusing.
I mean hitPoint and hitpointWorld give the same values, the code extraction shows that hitpointworld return hit value, so i suppose two bugs… i cannot test right now but i’ll put another PG test in a few hours.
I added the body hit by the ray and we see that “hitPoint” and “hitPointWorld” give the same values.
I add the body name touched just to be sure.
I also add an instance check and both vectors are the same.
I look at havok plugin code and I agree with you, it returns only world point and world normal of raycast result. I thought it was a bug because in the documentation hitPointWorld says : “Gets the hit point in the world” and hitPoint “Gets the hit point.” so when reading at it I assume that hitPoint was in local coordinates of the hitten body.
Doc here : Babylon.js docs
I made a small matrix/transform and I get my local coordinates.