Placing assets with physics

From HEWIKI
Jump to: navigation, search

Contents

He intermediate.png


See also: Physics Toolbar, which contains a beginner-level tutorial on how to use the toolbar, and Physics panel, which covers how to debug and configure collision representations.


Overview

This is a short tutorial on how to place assets using in-game physics. This is most useful when you want something to rest "naturally" on an uneven surface (like a wagon on hilly terrain), or when you're placing a lumpy object on a flat surface (like a sack of flour on a countertop).

Normally, you should use the Dynamic Place tool, but sometimes, it is better to use the physics engine.


Description

The location of an object may be different, depending on where the client thinks it is, and where the server thinks it is. Physics is generally handled on the client side, by the Physics plugin, which does not communicate its changes to the server. This is different from other ways to move objects. For example, when an object is moved in the client via one of the tools in the Transform Toolbar, the location is updated on the server. However, if any object "falls" due to physics, its location is not updated on the server, unless you explicitly tell the client to send an update to the server with the new location. This tutorial will walk you through how this works.


Ingredients

You will need the following for this tutorial:

Instructions


Enable physics

Physics section of the Properties panel (not to be confused with the Shape Editor of the Physics panel)

It is important to understand that when using physics, the position of the object may appear different on the client, than what is recognized by the server. To better visualize this:

PhysicsServerRepresentation.png
Holding down CTRL-D can generate a stream of objects falling out of the sky

Cleanup note

If you have ended up with dozens of the same object because of the CTRL-D exercise, there are multiple ways to delete them:

  1. Click on each one individually that you wish to delete with the selection pointer, HeroBladeTransformSelect.png and press DELETE. Or,
  2. Use the selection pointer to drag a box around all of them and press DELETE. Or,
  3. In the Assets panel, go to Model > sign_post_demo.gr2, select it, and then in the Instances subpanel, shift-click to select several (or all) of the instances, and then remove them via the Instances Menu link. Or,
  4. In the Assets panel, right-click the asset and select select "Remove asset". This will generate a couple warning popups, ensuring that you wish to do this.
RemovalWarning.png

RemovalWarning2.png
  • Since you are in a test area, it should be alright to remove all instances. Click "Yes".

After the deletion method of your choice, move the view in your viewport a bit, and all of the wireframes of the server representations should disappear.


Working with physics nodes

In building an area, it may be desired to have physics-enabled assets that don't react until a certain condition is met. For example, having a group of rocks at the top of a mountain, which will later fall via an avalanche, but shouldn't fall until after some other condition is met, such as a player being within view of them. This toggling of a group of objects in a physics simulation can be handled via a Physics Node. This node then becomes a parent object to all the "children" nodes for the physics simulation, so that they can be easily toggled on and off as a group.

See also

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox