May 2, 2021

Tool Guide – Duplicated Object Behaviors

Latest Version: 0

The Duplicated Object Behaviors tool works together with the In Scene Events Controller to set the behavior rules for objects that are duplicated. Because duplicated objects can be a variety of things, the Duplicated Object Behaviors tool gives you several options on what the object should do.

How to use

  1. Create the object that will be duplicated
  2. Drag and drop the duplicated object behaviors tool onto the object that will be duplicated. If the object is made of many parts, put the tool at the topmost part of that object’s hierarchy.
  3. Deactivate the game object that will be duplicated.
  4. Configure the duplication event in the In Scene Events Controller that will call this object into existence.

Section Information

Options

 

The options section contains 7 parts

  • The Self Destruct option
  • How many seconds to self destruct (if self destruct is chosen)
  • The physics concept to use
  • The Make Kinematic option (if Physics Motion is used)
  • The Affected by Gravity option (if not Kinematic and Physics Motion is used)
  • The Initial Forward Force option (if not Kinematic and Physics Motion is used)
  • The How Fast should it go option (if Constant Motion is used)

The Self Destruct option, if selected, starts a timer when the object is cloned that destroys the object after a set amount of seconds. It is a good idea to select this, as every object has a small computational overhead that can add up over time. If the object no longer matters after a certain amount of time (like a bullet or something) it is good to set this to true.

How many seconds to self destruct becomes an option if self destruct is set to true. This is how long the object will exist before it is destroyed.

The Physics concept to use determines how this object should move through space. There are three options: No motion, Physics Motion, and Constant Motion.

  • No Motion should be used if the object is animated or otherwise manages itself. The object will be cloned and activated at the location you specify, and if you don’t have it do something else with an animator or by putting your own physics scripts on it, it will stay there and not move.
  • Physics Motion applies a rigidbody to the object and joins the object into the Nvidia PhysX system. This means it can be interacted with, and can interact with other objects in your scene.
  • Constant Motion uses mathematics to move the object in the Z (blue arrow) direction at a set rate in meters per second.

If Physics Motion is selected in the Physics Concept to Use dropdown:

The Make Kinematic option lets you choose to disables movement physics on the object, but keeps it part of the Nvidia PhysX system. This means that other PhysX objects can still interact with it, but force applied to it will not affect its position and rotation. You probably don’t want this unless you know what you’re doing and have a specific type of physics simulation in mind.

Note that all Nvidia PhysX objects, regardless if they’re kinematic or not, have a mathematical CPU cost to run on the system that is pretty significant. Around 200 PhysX objects will will make your scene unplayable on Oculus Quest, so make sure you set a quick self destruct to keep the numbers from getting too high.

The Affected by Gravity option pulls the object downward at the earth gravity rate. It will fall until something else acts upon it, like a floor or other surface. If this is disabled, it will float in the air and fly away from you forever if it gets an opportunity to do so.

The Initial Forward Force is an explosive type of force that happens right after the object comes into existence. The unit this is in is super bizarre and nearly impossible to visualize (Newtons * Unity’s Fixed update interval which varies depending on how busy the scene is * your actual rendered framerate) so you will need to do trial and error to determine what a specific number feels like. This force also varies depending on if the user is using a VR headset, which all dynamically adjusts the value of force as a required aspect of the SDK in use (SteamVR or Oculus.) Regardless, that amount of force is applied in the Z (blue arrow) direction of the object.

If Constant Motion is selected in the physics concept to use dropdown:

The How Fast Should It Go setting is a value in meters-per-second at which the spawned object will move in the Z (blue arrow) direction after it is spawned in. It does not use Nvidia PhysX to do this with force, and instead moves its transform directly with math. This means that it does not build kinetic energy, and won’t strike into objects as you might expect a fast moving object to do.