Raycasting EN - Drova-Modding/Drova-Modding-API GitHub Wiki
Raycasting Layers
The Raycasting Layers can be found under
using Il2CppDrova;
The class is RaycastUtil
which provides static access to probably all the layers, inlcuding light, obstacles, player and hit layers.
There are also convenient methods for obstacles and light masks see here:
RaycastUtil.GetBigObstacleMask();
RaycastUtil.GetAllObstacleMask();
RaycastUtil.GetDynamicMask();
RaycastUtil.GetSmallObstacleMask();
RaycastUtil.IsAnyLightLayer(int layer);
Find a Random Position around the Player
For that we got a file from Johannes(HanHan), called Il2CppDrova.Spawners.ActorWorldRasterizerWorldLocator
which checks the obstacles and try to find a position in the min max radius provided. Because IL2CPP does not correctly point to this class method, we can't used it. So we got the source code and have it now on the managed side. Here is an example on how you could use it:
using Drova_Modding_API.Systems.Spawning;
namespace Example {
class Example {
ActorWorldLocator worldLocator = new();
/**
* Gets a spawn position or null if there is no free position in the min max radius
**/
Vector2? GetSpawnPositionAroundThePlayer(Vector2 playerPosition) {
return worldLocator.GetRandomFreePositon(playerPosition);
}
}
}