⌚
Timeflow
  • ⌚Introduction
  • 📗User Guide
    • â–ļī¸Getting Started
      • ✅Requirements
      • âŦ‡ī¸Installation
      • 🚀Quick Start
      • âœī¸Workflow
      • đŸŽŦRender Pipeline
      • â¯ī¸Editor vs Runtime
      • đŸĻŋHow it Works
      • â›‘ī¸Potential Issues
      • ⚡Optimization
      • 🔨3rd Party Tools
      • đŸ”ĸUpgrading Guide
    • â„šī¸Timeflow Editor
      • đŸŽ›ī¸Menu Bar
      • â˛ī¸Time
      • Local Time Scope
      • 🧰Work Area
      • âš™ī¸Settings
      • âŗUpdate Settings
      • đŸ“ēDisplay Lists
      • đŸ”ģMarkers
      • đŸ”ĩObject
      • 🏭Managed Objects
      • ⚡Quick Select Objects
      • âš’ī¸Tools
    • đŸŽŦTimeflow View
      • 🔩Toolbar
        • 🔑Auto Keyframing
        • â¯ī¸Play Controls
        • đŸĨ…Work Area
        • â¯ī¸Current Time
        • đŸŽŧMusical Timing
        • 🌐Grid and Snap
        • 🔸Keyframe Values
        • đŸ”ģMarkers
      • â˛ī¸Timeline
      • 📐Time Navigation
      • Local Time Scope
      • 🎏Track View
      • â†˜ī¸Selection
      • 📰Object Panel
      • đŸ“ēDisplay Lists
      • 🍱Channels
      • đŸŖProperties
      • 🔗Channel Link
      • đŸšĨSwitches
      • 📅Values Column
      • đŸ›¤ī¸Tracks
      • 🔸Keyframes
      • đŸ“ļAlignment Tools
      • ⌛Time Offset
      • đŸ”ĸInfo Panel
      • 📉Graph View
      • âœ‚ī¸Keyframe Tools
    • 🍰Menus & Shortcuts
      • 📃Context Menus
        • â†–ī¸Select Menu
        • 📰Object Menu
        • 🍱Channel Menu
        • đŸ›¤ī¸Tracks Menu
        • 🔸Keyframes Menu
        • đŸ”ģMarkers Menu
        • 📰View Menu
        • 📰Events Menu
        • đŸĨ…Work Area Menu
      • đŸ—ƒī¸File Menu
      • âš’ī¸Timeflow Menu
        • đŸ•ēAdd Behavior
        • đŸ”ļAnimation
        • 🍱Composition
        • đŸ“ēDisplay
        • ⏊Jump To
        • 👨‍đŸ‘Ļ‍đŸ‘ĻHierarchy
        • 🌐Mesh
        • 👉Select
        • 📚Tracks
        • 🌈Track Colors
        • â†”ī¸Transform
        • đŸ‘ī¸Visibility
        • đŸ› ī¸Editor
      • đŸ”ĩGame Objects Menu
      • đŸŽ›ī¸Presets
      • âš™ī¸Preferences
        • Assets
        • ⌛Time
        • đŸŗī¸â€đŸŒˆTracks
        • âšĒObjects
        • 🧮Channels
        • đŸ”ļKeyframes
        • 🔠Input
        • đŸ“ĨImport
        • đŸ–ŧī¸Rendering
        • đŸŽ›ī¸Overrides
        • 🍱Extras
      • *ī¸âƒŖKeyboard Shortcuts
        • Managing Shortcuts
      • âœ´ī¸Quick Menu
  • Reference
    • đŸ”ĩTimeflow Object
      • đŸĸTracks
      • 🏭Behaviors
      • ⏰Events
      • đŸ—ƒī¸Channels
    • 💃Timeflow Controller
      • đŸŽžī¸Timeflow Playback
    • đŸĒ„Behaviors
      • đŸŽžī¸Animation
        • 🔸Keyframer
        • â†”ī¸Tween
        • 🔀Blend
        • đŸŽĸMotion Path
        • đŸ‘¯Animation Clips
        • 🌴Animator Blend Trees
        • 😁Blend Shapes
      • 🤖Automation
        • 🛸Auto Bank
        • 🧭Auto Rotate
        • 📐Distance
        • ⏰Event
        • đŸ›Šī¸Flyby
        • 🏃Follow
        • 👀Look At
        • đŸŽ¯Look At Target
        • 🎲Noise
        • 🚊Place On Path
        • đŸī¸Place On Surface
      • 🔊Audio
        • 🔊Audio Track
        • đŸŽŧAudio Spectrum
        • đŸŽĩAudio Sample
        • đŸŽ™ī¸Audio Reactive
      • 🎹MIDI
        • 🎹Midi File
        • đŸĨMidi Tween
        • 📡Midi Receiver
          • đŸŽ›ī¸Minis Setup (New Input System)
          • đŸšĨMidiJack Setup (Legacy Input)
      • 🏁Rendering
        • đŸŽžī¸Render To Disk
        • 📋Render Queue
        • đŸ“Ŋī¸Video Encoding
        • 💡Tips & Optimizations
        • âēī¸Unity Recorder
      • 🔧Tools
        • â„šī¸Animator Info
        • 🧮Align Children
        • đŸ’ŦComment
        • #ī¸âƒŖFPS Counter
        • 📈Graph
        • 🔗Property Link
        • 🔄Rotator
        • ✨Particle System Update
        • 🌈Trail Renderer Update
        • đŸ“ēVideo Player Update
    • đŸ—ƒī¸Precomposing
    • 🏭Prefabs
    • đŸŽ›ī¸Editor Overrides
      • 🏹Transform Editor Override
    • 🔌Integrations
      • đŸ§™â€â™‚ī¸Adventure Creator
      • đŸŽ›ī¸MIDI Jack | Minis
      • đŸ¤ēSpine Animation
      • đŸ“Ŋī¸Unity Timeline
      • ➰Unity Splines
    • đŸĒSamples
      • đŸ•šī¸Demo App
      • đŸŽžī¸Cutscenes
      • 🏓Physics
      • 🍧Shader Properties
      • ⚡Visual Effect Graph (VFX)
    • 📖Glossary
    • 📗Scripting
    • đŸ“ŖPublished Works
    • âš ī¸Known Issues
    • 🆘Support
    • đŸ§ĒBeta
    • Roadmap
    • đŸ”ĸVersion History
    • ÂŠī¸Terms & Privacy
Powered by GitBook
On this page
  • Place On Surface Editor
  • Editor vs Runtime
  • Refresh All
  • Placement Mode
  • Sample Terrain Height
  • Raycast
  • Layer Mask
  • Raycast Direction
  • Use Transform
  • Raycast Offset
  • + Terrain Height
  • Raycast Distance
  • Apply to Transform
  • Use Rigidbody
  • Position
  • Smooth Time
  • Height Offset
  • World Limits
  • Rotation
  • Face Surface Hit
  • Smooth Time
  • Gizmos
  • Debug Ray
  • Additional Notes
  • Fixed Update
  • Using Explicit Update
  1. Reference
  2. Behaviors
  3. Automation

Place On Surface

Place objects on terrains and colliders

PreviousPlace On PathNextAudio

Last updated 2 years ago

Use this as both a creative tool for building scenes, as well as an animation behavior to dynamically place objects. More than just working with terrains, objects may also be placed on colliders of all types using raycasts.

To add Place On Surface, right-click an object in the Timeflow view and select:

Add Automation > Place On Surface

Place On Surface has two read-only channels, one for the final placed position and another for rotation. The latter is optional and may be hidden if not in use.

Place On Surface Editor

Select the object to view its settings in the Inspector.

Editor vs Runtime

Refresh All

Use this button to bulk update all instances of Place On Surface throughout the scene.

Use Refresh All after making changes to a terrain or the scene layout to update all placed items. This only affects Place On Surface instances currently active.

Placement Mode

Objects may be placed either using Raycast or Sample Terrain Height.

Please note that all placements are calculated and applied in world space.

Sample Terrain Height

Raycast

Optimization

Layer Mask

Restricts placement to only include terrains and colliders on the specified layers. This option is only available when using Raycast mode.

Avoid Same Object Collisions

Raycast Direction

Sets the direction of the ray, originating from the current position plus any offsets. This field expects a normalized value (all vectors adding up to 1). Normalization is automatically applied to ensure the length of the ray is consistent.

Use Transform

Enable this to orient the raycast direction towards another object in the scene. This is helpful to make an object follow the contours of an object from all angles.

Projecting Objects Onto Surfaces

Rays may be cast in any direction making it possible to place objects on surfaces from any angle simply by changing the Raycast Direction. This can also be used to make an object stick to another or to traverse the surfaces of multiple objects.

Raycast Offset

Offsets the starting point of the raycast along the direction vector.

Each raycast is like an arrow shot into the scene, detecting the first object hit. To ensure that the raycast starts at a far enough distance away from the target, an offset is often needed.

The X and Z axis offsets can also be used in special cases where the raycast needs to be shifted off center from the current position.

+ Terrain Height

If Terrain Height is enabled (recommended) the raycast is automatically offset by the height of the terrain so that the ray is always projected from a higher point. Otherwise, if the ray starts too low, it misses the terrain altogether and fails to place the object.

Failing to Place

Since the raycast origin is based on the object position, once placed it might fail on the subsequent update since the starting point is now on or possibly below the terrain.

As a remedy, the Terrain Height option is enabled by default. However, it may also be necessary to add an additional offset manually depending on the unique conditions of your scene. If placement is failing, the offset and distance may need adjustment.

Terrain Height can be disabled as an optimization if it isn't needed. Using only the offset and distance are often sufficient and the terrain height sampling can be skipped.

Raycast Distance

Sets the total length of the raycast. Only objects within this distance from the raycast origin may be detected. Placement occurs on the first collider or terrain hit. Adjust the distance according to the scale and needs of your scene.

Apply to Transform

Placement may be placed on the same object (current transform) or applied to the transform of another object. Which setup you use depends on the desired results.

Separate Transforms (placer vs item placed)

Applying results to a separate transform means that the current transform remains in place and is unaffected by placement. Since the origin of the raycast is based on the current transform, this can make placement more stable and avoid runaway conditions. This setup is also more conducive to using Place On Surface as a construction tool.

Use Rigidbody

If enabled, placement is applied to the rigidbody component instead of the transform. This method of moving the object produces the same results visually, however allows the object to correctly interact with physics.

Physics only works at runtime, so enter Play Mode to see final results. In edit mode, the transform is used instead as a proxy.

A rigidbody component is required to use this feature. If one is not found, a warning is shown with the option to fix the issue by adding a new rigidbody component. A collider may still be needed if you wish the object to interact with others.

Position

Enables positioning for all or individual axes to constrain placement to a specific axis or plane.

Smooth Time

Applies temporal smoothing based on the time seconds. Use the Max field to set the max value of the slider.

A small smoothing value is recommended for animation to avoid jitter.

Smoothing is only applied while playing in Timeflow. When rewinding or jumping in time, position is applied directly to avoid odd placement results.

Larger smoothing values will likely result in objects passing through surfaces and a lag in the animation overall.

Height Offset

Adds an offset to the placement position on the Y axis.

Use this to set the height of an object where it is resting at ground level. This is often the case for objects with centered pivot points and characters with a hip or root offset.

World Limits

Enable limits to constrain the placement of an object within a bounding region in world coordinates.

Rotation

The rotation channel is hidden from the Timeflow view if the Rotation mode is None.

Face Surface Hit

If enabled, the object orients to look at the point on the surface hit. Otherwise if off, the rotation matches the surface normal. This option is useful for projecting objects onto the surface of other objects, orienting to the projection angle rather than surface.

Smooth Time

Applies temporal smoothing over the specified time (in seconds). A longer time results in slower rotation, while a small time value responds more quickly.

Smooth mode is recommended for animation otherwise noticeable jitter may occur using Direct placement.

Smoothing is only applied while playing in Timeflow. Whenever rewinding or skipping time, rotation is applied directly to avoid anomalies with smoothing.

Gizmos

If enabled and using Raycast mode, the current direction and length is displayed using the display color selected.

Note that the Gizmos color is the same as the channel color in the Timeflow view.

Debug Ray

Draws lines in the color chosen precisely where raycasts are performed in 3D space. Each line remains visible for the duration specified.

This is a helpful investigation tool when placement isn't working as expected. Use Duration to set how long (in seconds) each ray remains visible in the Scene View.

Additional Notes

Fixed Update

Any other Timeflow behaviors on the same object should also be set to Fixed Update if they affect placement, such as when animating the object's position or rotation.

Using Explicit Update

For common features, please refer to and .

If you are using Place On Surface in the editor only, the runtime mode can be set in the menu bar to . This destroys the component at runtime but preserves it in edit mode.

This mode samples the height of the terrain using Unity's . If placement is only on terrains and the surface orientation isn't needed (i.e. the object doesn't need to rotate to the surface) then this mode is a more optimal choice than using Raycast.

Raycasting provides the best results since it can compute rotation and includes all terrains and colliders (according to the ). However raycasting is computationally intensive so should be used sparingly.

When using Raycast mode, it is recommended to change the update method to , so that it updates according to the framerate for physics. This reduces the number of raycasts overall and improves performance.

For more information, see and in the Unity documentation.

If the current object being placed is on the same layer as the , this may result in the object detecting itself (if it has a collider) which leads to a runaway condition causing the object to fly off into space.

To prevent this from happening, be sure the current object is on a different layer than the or simply remove collider components from the object if they are not in use.

Please refer to the Unity documentation for .

When using rigidbody for movement, it is recommended to use . This reduces the number of raycasts and improves performance.

Position limits are only enforced on each axis checked and according to .

Since raycasting is a physics feature, it is advised for optimal performance to use Fixed Update, set in the . This reduces the number of raycasts to the frame rate defined by in Project Settings under Time.

To place an object just once and prevent it from automatically updating, the update mode for the Place On Surface behavior may be set to Explicit in the .

Setting update to Explicit means that Place On Surface will not recalculate until you press the button.

đŸĒ„
🤖
đŸī¸
Menu Bar
Update Settings
built-in method
Raycast
Fixed Timestep
Layers and Layer Masks
Update Settings
Fixed Timestep
Update Settings
Layer Mask
Layer Mask
Layer Mask
Enable Position
Editor Only
Refresh
Fixed Update
Fixed Update
This mode has a simpler setup with fewer options.
X and Z are disabled automatically by the Enable Position states as shown in the example earlier.
Raycasts are drawn in red while playing the timeline. The thicker cyan line is the current direction and length.
The frequency of the raycast may be changed in the .
Update Settings