'MRTK Spatial Awareness - How to access Runtime Spatial Mesh Prefab?
I am trying to access the Runtime Spatial Mesh Prefab with another GameObject to activate its automatic Pulsing for the time I am placing an object with the TapToPlace Script.
The spatial Mesh Prefab in SpatialAwareness Settings
I took the Prefab from the Project to my GameObjects TapToPlace.OnPlacingStarted to activate StartPulsing() and stop it at TapToPlace.OnPlacingStopped.
But since the Prefab will just get activated at runtime it won't work like this but I can't figure out how I can get it at runtime..
Solution 1:[1]
If you just want to manually trigger the pulse, you can add the PulseShaderSpatialMeshHandler script to your GameObject and set the Surface Mat. Then call PulseOnce in TapToPlace.OnPlacingStarted():

Edit
I want to Pulse to be active as long as the user holds the object so he continously sees where the mesh is even when he changes location.
You can create your own PulseShaderHandler script and use SetLocalOrigin() to change the position and call StartPulsing() to make it pulse continuously. For example:
public class Test : PulseShaderHandler
{
protected override void Update()
{
SetLocalOrigin(transform.position);
}
public void startpulse()
{
StartPulsing();
}
}
Here is the document for PulseShaderHandler Class
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
