Physics Interactions
Different physics items are intractable using a left click over them. This attaches a force direction that pulls the item in the given vector. The player is able to use three of the at once and also reuse a given force on the same object on a different location without adding an additional vector. This mechanic is accomplished by sending out a raycast and upon successful intersection applies logic based on some meta data. Different objects may require different logic to act in a way that is expected by the player. Our goal is to make them feel that a force is being applied but the way in which we implement that experience may differ than how we previously expect.
An example are the sliders I started programming. Here I wanted an object that with slide along a given path created within the editor that could span some arbitrary amount of points and use any curve I desired. The natural choice was the utilize Godot’s built in Path3D and Pathfollow3D. The issue with these items is that they constraints that we that they work with translating an object along its path using the “progress” variable which is not inherently physics based. There were two main approaches I came up with that I could have taken. One is to adjust the constraints in the physics logic manually. This would require me to connect our physics object to a PathFollow3D and although this method would set up useful tools and experience for a physics based project I decided to go with the alternative approach.
I set up a state machine that shows whether the slider is idle, moving, or slowing down. Each state has logic that helps imitate a physics object. The great addition to this is including a collision box around it so that it still affects other entities in the world, like the player. This set up a physics-like interaction for the player but how we implement our mechanics may differ than how the player expects.