September 28, 2019

Tool Guide – Grabbable Object

Latest Version: 0

The Besti SDK Grabbable Object tool allows you to turn 3D objects into things that can be physically manipulated by the user. Objects with this tool assigned to them will be part of the physics system in Besti, so they are affected by gravity, and by other objects that influence physics. They also generate an outline when the user approaches the object to grab it.

In general, physics objects can be rather taxing on a system, so you probably want fewer than about 30-40 in a given scene. They only really tax the CPU when they are moving or interacting with other objects, though, so if they are mostly stationary (like an object that sits on a shelf) they shouldn’t cause too much of a problem. All of them moving at the same time, though, can cause a drop in framerate, or potentially crash Besti.

All grabbable objects require two components:

  • A mesh renderer (to handle drawing the object. All objects you can see have this already.
  • A collider to allow the object to exist in the physics system. This can be a box collider, a sphere collider, a capsule collider, or a mesh collider. Mesh colliders must be set to “Convex” mode due to a limitation of PhysX (so no bowls or cups that can act as containers for other physics objects.)

If you are familiar with Unity development you know that there are many other components required to make an object grabbable. Don’t worry about that in the SDK. Besti will handle all of that for you automatically.

Video Overview

How to use

  1. Add the “BestiSDK_GrabbableObject_x” tool to the game object you want to make grabbable.
  2. Drag-and-drop the object’s collider into the field marked “Collider”
  3. Configure any additional options that you may want on this object.

Section Information

Options

The options section contains 3 main parts

  • The Object Setup dropdown
  • The Collider field
  • The Advanced Options section

The Object Setup dropdown allows you to choose one of two concepts for how this object should work. The options are “Child” and “Joint” The selection here alters how Besti sets this object up for users, and is somewhat important. In general, most objects should use the “Child” type of configuration. In this configuration, when the user chooses to pick up an object, it becomes a child object of the user’s hand. Once that is the case, the system no longer needs to worry about physics at all, because it is being moved by the movement of the user’s hand. This is very fast and efficient, but has few options. In the “Joint” configuration, the grabbable object uses the PhysX subsystem to create a joint between the user’s hand, and the object. This means on every frame it calculates torque, velocity, and position to put the object where it is supposed to be. This is slower and less accurate regarding positioning of the object (you will notice a slight wiggle to the object as it is moved around in this mode), but has many more options.

The Collider Field tells Besti how to interpret this object in the PhysX subsystem. When forces are calculated, Besti does not know what an object looks like, and it only cares about what the collider looks like. This means, for instance, if you make a cube but put a sphere collider on it, the cube will roll around as if it were actually a sphere. Use whatever collider best matches the shape of the object you have created. Mesh colliders are unique in that they accurately conform to any shape, but they must be set to “Convex” mode for PhysX to understand it. This annoyingly precludes the possibility of a bowl-shaped object that reacts to physics, because the inside of a bowl is a concave shape. Convex mode will essentially “fill in” any concave shapes in the mesh.

The Advanced Options Section has various additional options that you can set if you are making a special object in your scene. Some options are only available in “Joint” mode in the Object Setup dropdown.

  • Joint Break Force is the amount of simulated force required to get the object to break its connection to the user. Try 1500 here, and adjust it upward or downward through trial and error if you think it is too sticky/not sticky enough. Even at an extremely high number, the object will break free from the user if he or she tries to push it through an immobile collider.
  • Gravity Settings determines how you want gravity to affect this object. There are three options. “Normal” is a simulation of typical earth gravity. “None” disables gravity entirely so the object freely floats. “Weird” allows you to assign a gravity level of your choosing.
  • Gravity Pull is an option that appears if you set the Gravity Settings to “Weird.” You can put in any negative number to have the object fall at that rate, or any positive number to have the object “fall” upwards if you choose to do that. -9.6 is typical earth gravity. The moon is -1.62. Mars is -3.7. You can play with this setting to make any sort of strange gravity situation you choose.
  • Linear friction is a setting to dampen linear movement in the scene. With no friction and no gravity, for example, the object will continue in motion forever until another force acts on it. With a small number here like 0.5, the object will slow to a stop even if there is no gravity. Mathematically, this adds a small amount of counter-force to this object while it is in motion and attempts to slowly bring it to a stop.
  • Attach Point Hands determines where the object will attach itself to your hand when grabbed. This is essentially an offset for where the object rests on the user’s hand. It is the same for both left and right hands.
  • The should this be treated as a platform checkbox determines if this object can be stood upon. This is probably desirable if the grabbable object is large, but if it is a small object, this can be confusing for the player.
  • The additional physics colliders list allows you to specify any child objects which should be part of the grabbable object. By default only the collider on the same object as the tool is made the grabbable point, but if you have an odd-shaped object made out of many simple colliders like spheres and boxes, it is useful to make the entire object grabbable. To do that, put those colliders in this list.