After implementing a telescoping arm and clamp covered in the previous post, Implementing the Clamp and UI in Unity — the next step is to interact with objects in the scene. The core design is based on the command-action pattern just like in the prototype discussed in Prototyping Robotic Factory Game in Unity3D. The scene is in 3D so position tracking is more complicated that simple bounding rectangles, I use triggers with compound colliders to detect object interactions.
I create another set of simple 3D models in Maya to represent the interactive and receiver objects. The interactive object is a simple cylinder that fits inside the clamp and the receiver a bucket.
The models are imported in Unity with applicable colliders and control scripts. The interactive object is configured with a simple Box Collider set as Triggers.
The receiver object is setup with the collider in the upper section where the object is expected to be placed for processing.
The Telescoping Arm Rods and Clamp Structure are setup with compound colliders per GameObject to follow the transform / positions as they are moved and to handle collisions with other objects.
Following is the view of the arm and clamp folded with the colliders matching position.
The sample WebGL app is posted at:
For questions, comments or contact – follow/message me on Twitter @rlozada