Skip to content

Latest commit

 

History

History
607 lines (347 loc) · 25.3 KB

Setup-For-Fuse-CC.md

File metadata and controls

607 lines (347 loc) · 25.3 KB

Setup For Fuse CC


Quick Links


[Setup For Fuse CC] is available in the Unity Asset Store.

Publisher: [The Development Blog of Tim Graupmann]

Feedback


Send your questions, feedback, or feature requests to support@theylovegames.com.

Audience


Anyone who wants to use Adobe Fuse CC to create characters and wants to use those chracters in Unity can use this package.

Anyone who used an existing character from Mixamo.com and added the Scary Zombie Animation Pack to their character can use this package.

Anyone who uploaded models to Mixamo.com and added the Scary Zombie Animation Pack to their character can use this package.

Compatibility


This package is targeted for Unity 5.3.1 or better.

This package extends the Unity editor.

This package is compatible with Adobe Fuse CC.

This package is compatible with animated models from Mixamo.

This package is compatible with Oculus Rift DK1.

This package is compatible with RAIN AI for Unity.

This package is compatible with UFPS : Ultimate FPS.

What is in this package?


This package includes editor scripts that provide automatic setup via add menu items.

This package includes animated models that were created in Adobe Fuse CC.

Tutorials


You will find detailed tutorial videos on our YouTube channel in the Setup For Fuse CC Playlist.

Adobe Fuse CC to Unity UFPS (00:16:15)
Adobe Fuse CC to Unity UFPS
Mixamo to Unity (00:02:11)
Mixamo to Unity
Import RAIN AI for Unity into Unity (00:00:56)
Import RAIN AI for Unity into Unity
Set up a Waypoint Route in RAIN AI for Unity (00:08:24)
Set up a Waypoint Route in RAIN AI for Unity
Mixamo to Rain AI For Unity Waypoint Routes (00:03:49)
Mixamo to Rain AI For Unity Waypoint Routes
Quick RAIN Setup for Mixamo with Scary Zombie Pack AI (00:04:39)
Quick RAIN Setup for Mixamo with Scary Zombie Pack AI
Scary Zombie Pack AI - Mixamo / Rain AI / UFPS Setup Automation (00:03:22)
Scary Zombie Pack AI - Mixamo / Rain AI / UFPS Setup Automation

Example Scenes


Example scenes are located in Assets/SetupForFuseCC/Scenes.

Example Scene RainUFPSWaypoints - This example scene shows RAIN characters running around a Navigation Mesh cycling between waypoints. RAIN characters have a Visual Sensor and will detect players with a Visual Aspect. RAIN characters chase the player while in visual range. RAIN characters will attack the player when close enough. RAIN must be imported and enabled before opening this scene. UFPS must be imported and enabled before opening this scene.

Example Scene NavMeshUFPSWaypoints - This example scene shows NavMesh Agents running around a terrain with obstacles and cycling between waypoints. NavMesh Agents have a Visual Sensor and will detect players with a Visual Aspect. NavMesh Agents chase the player while in visual range. NavMesh Agents will attack the player when close enough. UFPS must be imported and enabled before opening this scene.

Dependencies

Before opening the example scenes, be sure to enable Oculus and/or RAIN and/or UFPS as applicable.

Some layers and tags are needed before opening the example scenes.

Layers

Be sure that the layers exist for Ground and Enemy.

image_18

Tags

Be sure that the tags exist for Obstacle and Player that the RAIN example scene will use.

Enable VR Headsets


This package has been tested with the Oculus DK1 and Samsung GearVR.

This package is compatible with Oculus Utilities for Unity 5 SDK Examples.

The Oculus Runtime for Windows should be installed.

The Oculus Utilities for Unity 5 SDK Examples package must be imported before support is enabled.

To enable support, add OCULUS_SDK to the Platform Custom Defines.

Multiple Platform Custom Defines are supported and are separated with a semicolon while the order of the items are not important. I.e.

OCULUS_SDK;UFPS;RAIN_AI

After support is enabled, Oculus submenu items will appear within the Fuse menu.

image_27

Copy the ProjectSettings.asset from the Oculus SDK into your ProjectSettings folder to provide the resolutions needed for the Oculus. If this step is skipped, the Editor will crash on start.

Copy the InputManager.asset from the Oculus SDK into your ProjectSettings folder to provide support for a wired XBOX 360 controller. The left-stick will control movement. The right-stick will control the horizontal look.

Enable RAIN AI for Unity


This package is compatible with RAIN AI for Unity.

The RAIN AI for Unity package must be imported before support is enabled.

To enable support, add RAIN_AI to the Platform Custom Defines.

Multiple Platform Custom Defines are supported and are separated with a semicolon while the order of the items are not important. I.e.

OCULUS_SDK;UFPS;RAIN_AI

After support is enabled, Fuse submenu items will appear within the RAIN menu.

image_2

Enable UFPS : Ultimate FPS


This package is compatible with UFPS : Ultimate FPS.

The UFPS package must be imported before support is enabled.

To enable support, add UFPS to the Platform Custom Defines.

Multiple Platform Custom Defines are supported and are separated with a semicolon while the order of the items are not important. I.e.

OCULUS_SDK;UFPS;RAIN_AI

After support is enabled, UFPS submenu items will appear within the Fuse menu.

image_1

Fuse CC


This package supports models created in Adobe Fuse CC. Fuse CC is part of Adobe Creative Cloud. Design a character and then click the Save to Mixamo button to upload the character to the Mixamo website for auto-rigging and animation retargeting.

image_14

Mixamo


Mixamo has a collection of characters that can be animated with animation packs and then downloaded into Unity.

Scary Animation Pack

This package supports Mixamo models that have the Scary Animation Pack applied. Be sure to check the In Place option for the animations in the pack to maximize compatibility.

image_15

Oculus Rift DK1

Be sure to enable Oculus.

The menu item Fuse->Set Oculus Rift DK1 [First Person Camera] automatically creates the OVRPlayerController GameObject in the scene and sets up the main camera for the Oculus.

image_28

The OVRPlayerController GameObject has a default Character Controller, camera, and headtracking setup.

image_29

After hitting Play, the scene should display in the Oculus Rift DK1, headtracking, and controller input should be working.

image_30

Getting Started: Without RAIN and without UFPS

1 Start with a new project.

2 Import the Setup For Fuse CC package.

3 Create and save a new scene.

4 Use the Fuse->Setup Navmesh [Waypoint Obstacles] menu item.

You should be prompted to create a "Ground" layer and "Obstacle" tag.

Repeat step, if prompted.

5 Select a Mixamo animation pack like the sample Assets\SetupForFuseCC\Models\DinerShortRoundHead\DinerShortRoundHead.fbx model.

The animation pack downloads as a zip. You'll want to extract the zip. And select the model that doesn't have the '@' symbol in the name.

6 Use the Fuse->Setup Navmesh [Agents] Scary Zombie Pack menu item.

This will auto create an animation controller and add agents and spawners to the scene.

7 Hit 'Play' and in the Scene View you can see the zombies running around.

8 Without UFPS, you'll have to create your own player/camera rig to run around the map.

Unity Built-in NavMesh Agents


Getting Started

Create a New Scene

Start with a new scene and save the scene. A scene has to be saved to bake a NavMesh.

image_3

Create Waypoint Obstacles

The menu item Fuse->Setup NavMesh [Waypoint Obstacles] automatically creates a terrain with obstacles and waypoints. Obstacles show that the NavMesh Agents can navigate the NavMesh while patrolling a set of Waypoints.

image_4

Terrain provides a floor to walk on. Obstacles are a set of cubes shaped like buildings spaced apart to give room for the NavMesh Agents to avoid. The obstacles are colored to make navigating the scene easy while inspecting NavMesh Agents. The NavMeshAgentTargets are a set of GameObjects to be used as patrol Waypoints.

image_5

Setup the UFPS Player

The menu item Fuse->Setup NavMesh [UFPS Player] is only available when UFPS is enabled. The menu item creates a UFPS player with a Visual Aspect for NavMesh Agents to sense. The UFPS player has a first-person controller and is capable of running around the obstacle course. The UFPS has the damage handlers, colliders, and a starting inventory already setup. Since UFPS players have their own cameras, the default Main Camera is disabled. At this point, the player can run around the scene and shoot.

image_6

Setup the Player

The menu item Fuse->Setup NavMesh [Player] Visual Aspect adds a Visual Aspect to the player so that NavMesh Agents can detect the player. This can be used on UFPS players or generically on something like the Standard Assets where a Character Controller was used. A Visual Aspect will work for a first-person or third-person perspective controller.

image_7

Setup NavMesh Agents With Scary Zombie Pack

The menu item Fuse->Setup NavMesh [Agent] Scary Zombie Pack can only be used when the main Mixamo character model is selected. For example, select the Assets\SetupForFuseCC\Models\DinerShortRoundHead\DinerShortRoundHead.fbx model in the project view before invoking the menu item. The menu item will automatically generate an Animator Controller for the Mixamo character that is compatible with the Scary Zombie Pack from Mixamo. The Animator Controller will be created in the same folder as the Mixamo character. The menu item will apply some material fixes on the Mixamo model.

image_8

If the Mixamo character has an existing Animator Controller the editor will prompt before replacing it.

image_9

A GameObject named NavMeshAgents will be added to the scene, if missing, which holds the templates for NavMesh Agents that will be spawned. A GameObject named NavMeshAgentSpawners will be added to the scene, if missing, which holds the spawner instances for the NavMesh Agents. The spawners control the rate at which the agents are spawned. New agents will be spawned at the spawner locations. Templates should be deactivated before hitting play. A template might become unspawnable if it gets destroyed by dying if it was accidentally activated in PLAY mode.

image_10

When the Animator Controller was generated, the menu item automatically scanned the Mixamo model animations to automatically create all the state transitions. The menu item also auto generated the Mechanim parameters used in the state diagram. The Animator Controller is already properly referenced by the NavMesh Agent.

image_13

Setup NavMesh Agent Templates

The menu item Fuse->Setup NavMesh [Enemy] Scary Zombie Pack should only be run on a NavMesh Agent template. The menu item performs a subset of setup tasks from the previous item, excluding generating the Animator Controller, excluding the material fixes, and excluding creating the spawn items. The menu item adds a Visual Sensor so that a Zombie can find the Player. The menu item also adds a Capsule Collider to the spine of the NavMesh Agent. The below image has the template enabled only for documentation purposes. NavMesh Agent templates should be deactivated to be used properly.

image_11

Setup NavMesh Agents for UFPS

The menu item Fuse->Setup NavMesh [UFPS Enemy] Scary Zombie Pack should only be run on a NavMesh Agent template. For example, select the NavMeshAgents\Agent - DinerShortRoundHead2 in the scene before invoking the menu item. The menu item adds a Damage Handler so that the Zombie can be damaged by the UFPS Player. The menu item will only display if UFPS is enabled. The below image has the template enabled only for documentation purposes. NavMesh Agent templates should be deactivated to be used properly.

image_12

NavMesh Agent Patrols

At this point, the NavMesh Agents will cycle between their respective waypoints.

image_16

If the NavMesh Agents sense a Visual Aspect they will chase and attack their target.

image_17

RAIN AI for Unity


RAIN - Create a New Scene

Start with a new scene and save the scene.

image_3

RAIN - Tags

Add custom tags for Obstacle and Player that the Navigation Mesh will use.

RAIN - Add Ground Layer

The ground layer will be used on raycasts to ignore the ground layer.

image_18

RAIN - Create Waypoint Obstacles

The menu item RAIN->Setup RAIN [Waypoint Obstacles] automatically creates a terrain with obstacles and waypoints. Obstacles show that the RAIN Agents can navigate the Navigation Mesh while patrolling a set of Waypoints.

image_19

RAIN - Generate Navigation Mesh

Select Navigation Mesh in the scene and click the Generate Navigation Mesh button in the inspector. RAIN generates a Navigation Mesh that ignores Player tags and marks Obstacle tags as unwalkable areas.

image_20

RAIN - Setup the UFPS Player

The menu item RAIN->Setup RAIN [UFPS Player] is only available when UFPS is enabled. The menu item creates a UFPS player with a Visual Aspect for RAIN Agents to sense. The UFPS player has a first-person controller and is capable of running around the obstacle course. The UFPS has the damage handlers, colliders, and a starting inventory already setup. Since UFPS players have their own cameras, the default Main Camera is disabled. At this point, the player can run around the scene and shoot.

image_21

RAIN - Setup the Player

The menu item RAIN->Setup RAIN [Player] Visual Aspect adds a Visual Aspect to the player so that RAIN Agents can detect the player. This can be used on UFPS players or generically on something like the Standard Assets where a Character Controller was used. A Visual Aspect will work for a first-person or third-person perspective controller.

image_22

RAIN - Setup RAIN Agents With Scary Zombie Pack

The menu item RAIN->Setup RAIN [Agent] Scary Zombie Pack can only be used when the main Mixamo character model is selected. The menu item will automatically generate an Animator Controller for the Mixamo character that is compatible with the Scary Zombie Pack from Mixamo. The Animator Controller will be created in the same folder as the Mixamo character. The menu item will apply some material fixes on the Mixamo model.

image_23

If the Mixamo character has an existing Animator Controller the editor will prompt before replacing it.

image_9

A GameObject named RAINAgents will be added to the scene, if missing, which holds the templates for RAIN Agents that will be spawned. A GameObject named RAINAgentSpawners will be added to the scene, if missing, which holds the spawner instances for the RAIN Agents. The spawners control the rate at which the agents are spawned. New agents will be spawned at the spawner locations. Templates should be deactivated before hitting play. A template might become unspawnable if it gets destroyed by dying if it was accidentally activated in PLAY mode.

image_26

When the Animator Controller was generated, the menu item automatically scanned the Mixamo model animations to automatically create all the state transitions. The menu item also auto generated the Mechanim parameters used in the state diagram. The Animator Controller is already properly referenced by the NavMesh Agent.

image_13

RAIN - Setup RAIN Agents for UFPS

The menu item RAIN->Setup RAIN [UFPS Enemy] Scary Zombie Pack should only be run on a RAIN Agent template. The menu item adds a Damage Handler so that the Zombie can be damaged by the UFPS Player. The menu item will only display if UFPS is enabled. The below image has the template enabled only for documentation purposes. RAIN Agent templates should be deactivated to be used properly.

image_24

RAIN - RAIN Agent Patrols

At this point, the RAIN Agents will cycle between their respective waypoints. The player will be chased and attacked if the RAIN Agent senses the player. The RAIN Behaviour Editor will show the active RAIN state in the Behaviour Tree when the RAIN Agent is selected in the inspector.

image_25

Bug Fixes

Some 3rd party packages have some bug fixes yet to be published.

UFPS 1.7

UFPS 1.7 removed the FallImpactSounds field from vp_FPPlayerDamageHandler.

Comment out the following lines from MenuSetupPack.cs.

//playerDamageHandler.FallImpactSounds.Add(AssetDatabase.LoadAssetAtPath<AudioClip>(@"Assets/UFPS/Base/Content/Sounds/Player/FallImpact/FallImpactGeneric01.ogg"));
//playerDamageHandler.FallImpactSounds.Add(AssetDatabase.LoadAssetAtPath<AudioClip>(@"Assets/UFPS/Base/Content/Sounds/Player/FallImpact/FallImpactGeneric02.ogg"));

UFPS 1.6

UFPS has some bug fixes that have yet to be incorporated into the release version. The following fixes correspond to UFPS 1.5.2 and UFPS 1.6.

Cursor Handling

In UFPS, pressing ESC exits FPS mode and shows the cursor in the editor. This fix gives better Cursor handling in Unity 5.3.1 on Windows 10. Here's an enhancement for the LockCursor property in vp_Utility.

Assets\UFPS\Base\Scripts\Core\Utility\vp_Utility.cs

	/// <summary>
	/// shows or hides the mouse cursor in a way suitable for the
	/// current unity version
	/// </summary>
	public static bool LockCursor
	{

		// compile only for unity 5+
		#if (!(UNITY_4_6 || UNITY_4_5 || UNITY_4_3 || UNITY_4_2 || UNITY_4_1 || UNITY_4_0 || UNITY_3_5))
		get
		{
			return ((Cursor.lockState == CursorLockMode.Locked) ? true : false);
		}
		set
		{
			// toggling cursor visible and invisible is currently buggy in the Unity 5
			// editor so we need to toggle brute force with custom arrow art
			#if UNITY_EDITOR
				Cursor.SetCursor((value ? InvisibleCursor : VisibleCursor), Vector2.zero, CursorMode.Auto);
			#endif
			// running in a build so toggling visibility should work fine
			Cursor.visible = !value;
			Cursor.lockState = (value ? CursorLockMode.Locked : CursorLockMode.None);
		}
#else
		// compile only for unity 4.6 and older
		get { return Screen.lockCursor; }
		set { Screen.lockCursor = value; }
#endif

	}

Player Inventory Null Checking

Fixed in UFPS 1.7. UFPS didn't expect some things to be called in edit mode. Here's a fix to add a null check in the player inventory script. Find the Reset method on vp_PlayerInventory.

Assets\UFPS\Base\Scripts\Gameplay\Player\vp_PlayerInventory.cs

	/// <summary>
	/// Reset the player inventory
	/// </summary>
	public override void Reset()
	{

		m_PreviouslyOwnedItems.Clear();
		m_CurrentWeaponInstance = null;

		if (null != m_Misc && //added missing null check
            !m_Misc.ResetOnRespawn)
			return;

		base.Reset();

	}

Player Inventory Wield Null Checking

Fixed in UFPS 1.7. Find the TryWieldNewItem method on vp_PlayerInventory. This adds missing null checks and notice this method uses the legendary goto.

Assets\UFPS\Base\Scripts\Gameplay\Player\vp_PlayerInventory.cs

    /// <summary>
	/// Try to wield an item
	/// </summary>
	protected virtual void TryWieldNewItem(vp_ItemType type, bool alreadyHaveIt)
	{

		bool haveHadItBefore = m_PreviouslyOwnedItems.ContainsKey(type);
		if (!haveHadItBefore)
			m_PreviouslyOwnedItems.Add(type, null);

		// --- see if we should try to wield a weapon because of this item pickup ---

		if (null != m_AutoWield && //added missing null check
            m_AutoWield.Always)
			goto tryWield;

		if (null != m_AutoWield && //added missing null check
            m_AutoWield.IfUnarmed && (WeaponHandler.CurrentWeaponIndex < 1))
			goto tryWield;

		if (null != m_AutoWield && //added missing null check
            m_AutoWield.IfOutOfAmmo
			&& (WeaponHandler.CurrentWeaponIndex > 0)
			&& (WeaponHandler.CurrentWeapon.AnimationType != (int)vp_Weapon.Type.Melee)
			&& m_Player.CurrentWeaponAmmoCount.Get() < 1)
			goto tryWield;

		if (null != m_AutoWield && //added missing null check
            m_AutoWield.IfNotPresent && !m_AutoWield.FirstTimeOnly && !alreadyHaveIt)
			goto tryWield;

		if (null != m_AutoWield && //added missing null check
            m_AutoWield.FirstTimeOnly && !haveHadItBefore)
			goto tryWield;

		return;

	tryWield:

		if ((type is vp_UnitBankType))
			TryWield(GetItem(type));
		else if (type is vp_UnitType)
			TryWieldByUnit(type as vp_UnitType);
		else if (type is vp_ItemType)	// tested last since the others derive from it
			TryWield(GetItem(type));
		else
		{
			System.Type baseType = type.GetType();
			if (baseType == null) //added missing null check
				return;
			baseType = baseType.BaseType;
			if ((baseType == typeof(vp_UnitBankType)))
				TryWield(GetItem(type));
			else if (baseType == typeof(vp_UnitType))
				TryWieldByUnit(type as vp_UnitType);
			else if (baseType == typeof(vp_ItemType))
				TryWield(GetItem(type));
		}
		
	}

Change Log


1.0 - Initial submission of package.

Q & A


You can send comments/questions to support@theylovegames.com where your feedback will help us create new tutorials and features in order to improve the product.

Roadmap


Upcoming Features:

  • VR setup automation.
  • Easy weapon setups
  • Don't show shells on player/enemy colliders
  • Support Pro Archer Animation Pack
  • Add Bows and Arrows