GroupThesis2024 / Paramedic-Training-Game

0 stars 0 forks source link

[DESIGN] Classes for interactable objects #23

Open hsniemi opened 7 months ago

hsniemi commented 7 months ago

Designing classes with an abstract base class for creating interactable objects, such as a medical bag and equipment.

hsniemi commented 7 months ago

Initial sketch of classes image

henrysneps commented 7 months ago

Image

As discussed, here's a quick class diagram sketch to help to narrow down the scope of this task. The diagram is not definitive and more methods or fields can be added as deemed needed, Most notably here all the OnSomething() should be left unimplemented, so that the concrete instances of this base class may do that if they need to. The other methods, such as Grab(), Release(), and Interact() should however be implemented in the abstract class itself.

The main task here would be to figure out the best way to link the grabbable object to a parent Transform provided in the Grab() method.

hsniemi commented 7 months ago

image

hsniemi commented 7 months ago

The branch containing the code for this issue: https://github.com/GroupThesis2024/Paramedic-Training-Game/tree/ISSUE%2323-design-classes-for-interactables

hsniemi commented 6 months ago

I tried a different way of grabbing the object. Instead of setting the controller as the parent of the grabbable object in Grab() method, I set the parent Transform as the target toward which the object moves in FixedUpdate(). This eliminated the erradic behaviour (attaching far from the parent, flying away on grab, sometimes falling through other objects when detaching) of the object which was only manifesting when using a real vr device.

Grab() and FixedUpdate() methods in Interactable class image

image