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

PickingInfo getTextureCoordinates: Allow to choose the uv set #13673

Merged
merged 1 commit into from
Mar 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/dev/core/src/Collisions/pickingInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,11 @@ export class PickingInfo {

/**
* Gets the texture coordinates of where the pick occurred
* @param uvSet The UV set to use to calculate the texture coordinates (default: VertexBuffer.UVKind)
* @returns The vector containing the coordinates of the texture
*/
public getTextureCoordinates(): Nullable<Vector2> {
if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(VertexBuffer.UVKind)) {
public getTextureCoordinates(uvSet = VertexBuffer.UVKind): Nullable<Vector2> {
if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(uvSet)) {
return null;
}

Expand All @@ -158,7 +159,7 @@ export class PickingInfo {
return null;
}

const uvs = this.pickedMesh.getVerticesData(VertexBuffer.UVKind);
const uvs = this.pickedMesh.getVerticesData(uvSet);
if (!uvs) {
return null;
}
Expand Down