Skip to content

max-van-leeuwen/SnapLensStudio-Raycasting

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

SnapLensStudio-Raycasting

Raycast any mesh to get the position and rotation. From this tweet. Uses the PinToMesh component in combination with the snap() function to do a hit test on a 3D model.

twitter @maksvanleeuwen
instagram @max.van.leeuwen
maxvanleeuwen.com

Raycasting on any mesh, muddy solution.
Returns position and rotation to place an object on the mesh where ray intersects.

Issues:
 - Mesh UVs are irreversibly overwritten with projected UVs. Duplicate mesh resource if mesh UVs are important.
 - Raycasting needs a delay, which is why it cannot return a value instantly. It uses a callback function instead.

Usage:
	script.api.raycast(callback, renderMeshVisual, startPos, endPos)
		callback 			: a function with arguments (position [vec3], rotation [quat]) that will be called when raycast is complete
		renderMeshVisual 		: the mesh to raycast
		startPos 			: world position start of ray
		endPos 				: end position end of ray

About

Raycast any mesh and retrieve positional and rotational information.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published