Extending the Toolkit
The Decorating Toolkit was designed with flexibility in mind. Almost every part of the system is built on interfaces, so if the default behavior doesn't fit your game, you can easily swap it out with your own logic.
TODO: Add a simple architecture diagram showing how the Controller, Motors, and Validators interact.
Main Extension Points
1. Custom Dragging Logic
Want your objects to rotate while being dragged, or move along a specific curve? Implement IDragMotor.
public class MyCustomDragMotor : MonoBehaviour, IDragMotor {
public Vector3 GetDragPosition(InteractionContext context) {
// Your custom logic here
return transform.position;
}
}
2. Custom Placement Validation
If you need complex rules like "you can only place this chair on a rug", you can implement IPlacementValidator.
public class MyPlacementValidator : MonoBehaviour, IPlacementValidator {
public PlacementValidationResult Validate(InteractionContext context) {
// Check for specific conditions
bool isOk = CheckMyCustomRules();
return isOk ? PlacementValidationResult.Valid() : PlacementValidationResult.Invalid("Custom reason");
}
}
3. Custom Input
If you're building for VR or a unique controller setup, implement IPointerSource to tell the toolkit where the user is pointing.
public class MyInputSource : MonoBehaviour, IPointerSource {
public bool TryGetPointer(out PointerState pointerState) {
// Calculate your pointer position and state (exmp, world ray)
pointerState = new PointerState { ... };
return true;
}
}
How to use your extensions
Once you've written your custom class, just attach it to a GameObject in your scene and assign it to the corresponding field in your Profiles or Decorating Toolkit Settings. The system will automatically start using your logic!