Description
The Bone
field in the SceneTraceResult
struct represents the identifier of the bone that was hit during a trace operation. This identifier can originate from either a hitbox or a physics shape, providing a way to determine which specific bone was impacted in a complex object.
Usage
Use the Bone
field to identify the specific bone that was hit in a trace operation. This can be particularly useful in scenarios where you need to apply logic based on which part of a model was impacted, such as applying damage to a specific limb in a character model.
Example
// Example of accessing the Bone field from a SceneTraceResult
SceneTraceResult traceResult = PerformTrace();
int hitBoneId = traceResult.Bone;
if (hitBoneId != -1) // Assuming -1 indicates no bone was hit
{
// Logic to handle the hit on a specific bone
Console.WriteLine($"Hit bone ID: {hitBoneId}");
}