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

Use paintMask layer in Double raycasting #10

Merged
merged 2 commits into from May 2, 2019

Conversation

@Ajk4
Copy link
Contributor

Ajk4 commented May 1, 2019

Code casts ray from up towards the mesh being painted one.
Hovewer this raycast not using paintMask could collide with some
colliders in between.

Example use-case is painting on the bottom of the lake and rays colliding
with water plane. Or perhaps painting prefabs inside a building with a roof.

Code casts ray from up towards the mesh being painted one.
Hovewer this raycast not using paintMask could collide with some
intermediate colliders.

Example use-case is painting on the bottom of the lake and rays colliding
with water plane.
@Ajk4

This comment has been minimized.

Copy link
Contributor Author

Ajk4 commented May 1, 2019

Second commit -> second raycast should hit freshly spawned object so it should use this object layer mask instead of paintMask.

@AlexanderAmeye AlexanderAmeye merged commit 7bc1e0a into AlexanderAmeye:master May 2, 2019
@Ajk4

This comment has been minimized.

Copy link
Contributor Author

Ajk4 commented May 2, 2019

FYI @AlexanderAmeye some additional comments/insights after working with the code:

1 :
Problem might still occur. Theoretically object of mask paintMask could still be inbetween 'high-up' and 'mesh-im-painting-on'.

The 'proper' solution would probably be to use RaycastAll and look for wanted object in the list. If I hit the problem again I will probably fix it but for now I'm just leaving a comment to spread the knowledge.

2 :
Also I'm not sure why we need first raycast. Don't we already have the point on the surface we're painting on? We use it for drawing gizmos and visualize brush in inspector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.