This is just an example.. Some minor modifications might need to be made to make this work.
I will update this code after testing in later today.
5-9-2013
/*
/ FocalControl.cs
/ Use this script to control the focal
/ distance of a DOF in Unity3D
*/
public class FocalControl :Monobehaviour
{
// Change the class name 'DOFShader'
// to match the DOF shaders class name
public DOFShader dofShader;
public Transform cameraTransform;
public float focalTransitionSpeed = 5.0f;
void Update()
{
RaycastHit rhit;
if(Physics.Raycast(cameraTransform.position, cameraTransform.forward, out rhit, Mathf.infinity))
{
dofShader.focalDistance = Mathf.Lerp(dofShader.focalDistance, rhit.distance, Time.deltaTime * focalTransitionSpeed);
}
}
}
Controlling Focal Distance
QuickRopes2 Update 3-20-13
The long wait is nearly over! Recently I have been silent on my progress but lots of progress has been made! Below you will find a list of things that have been changed.
1) PHYSICS: When I started QuickRopes2 I decided that I was going to make everything modular. Which meant a programmer could go in and easily add on their own custom physics implementation code. Well after long thought and many pains I decided it does not make sense to separate the physics from the main script. So now you will find 3 tabs at the top of the QuickRope2 inspector. One is labeled “Physics” which is where you can enable/disable your physics and customize your physics settings!
2) MESH RENDERING: I got with an outside developer and spent some cold hard cash for them to develop a nicer looking Tube Mesh generator. The generator works with both traditional Physics joints and the newly implemented cloth based rope.
3) ATTACHMENTS: Today I worked on implementing the attachments script so you can attach objects to the rope. The attachments are represented in the editor as little green solid dots. You can assign the object to the joint you want to attach it to. Then center the object via a simple click of a button. This release will only allow for “Fixed Joint” type joints. But 2.1 should include other various types of joints to select from.
4) VIDEO TUTORIALS: This weekend I will be working on several things! One of the things will be the video tutorials and documentation that will be included with QuickRopes2. These tutorials will be pretty basic but future tutorials will cover more advanced topics such as programming with QuickRopes!
5) ROPE CONTROLLER: A popular feature of QuickRopes 1.2 is the ability to increase and decrease the length of your rope at run-time. This is currently in development and almost done. I have been having consistency issues with long-term use. The links seem to get out of sync after a few joints.
6) MORE: I can’t think of anything else to add but there is a lot of stuff on my plate for the weekend. I will be sure to update this post with images and more information as it comes to me!
Thanks for your loyalty and interest in QuickRopes2! Hope you have a wonderful experience.
Jake Fletcher
CHECK OUT A SAMPLE SCENE FROM QUICKROPES2 HERE!

QuickRopes2 Update 2-13-12
Happy early Valentines day everybody!
Yesterday I released Alpha pack 2.0.6 to my alpha/beta group. I wanted to remind everyone who purchases QuickRopes that they are welcome to email me at jake@reverieinteractive.com or via the contact tab to get into the Beta group. Please provide your Invoice number!
Jake
QuickRopes2 Update 2-1-13
Hello friends!
FEATURE UPDATE:
This weekend I added several new features. I added a mesh script to generate tube meshes, a new physics script to add physics, an improved prefab script to better align the prefabs generated, started work on the rope climbing script, and finally added support for cloth meshes.
MESH TYPE: The biggest addition to this from previous versions of QuickRopes is the ability to edit the shape of your mesh based on curve data. If you want your rope to have a bulge in the center, then you simply add a spline point to the “radius” curve and it appears. This will be helpful if you want to create geometry like a rope that has tassels on the end, or a bundled up curtain. Also included is the “Use Static Mesh” toggle. This will let enable you to treat he mesh as if it is a simple piece of geometry (ZERO mesh rebuilding).
CLOTH MESH: This is based on the same script used to construct the regular tube mesh ropes except it uses the “InteractiveCloth” and “ClothRenderer” components.
CLIMBING SCRIPT: This is still a WIP. I am able to make a point travel up and down the rope. The hard part comes when your trying to figure out at which point the character comes in contact with the rope!
Technical Shizzle-wizzle:
In my previous update I stated that I was going back to the following code architecture:
// Make a script derive from the "RopeMeshPlugin" class. This class
// will be called by the parent QuickRope2 script without any need
// for the script to be a Monobehaviour. Thus eliminating the need
// to use [ExecuteInEditMode()]
public class MyMeshScript : RopeMeshPlugin
{
public coverride void GenerateMesh()
{
// This variable is automatically stored in the inherited class
// "RopeMeshPlugin"! So there is no need to pass variables
// through the method.
List<GameObject> jointsInRope = rope.Joints;
}
}
Unfortunately I found out why I decided to not go this route in previous versions! As it turns out, Unity does not allow you to “plugin” scripts in the manner I had hoped. In order to make this work I would have to do some background coding in the editor script to search plugins that are available in the project folder and allow for those plugins to be enabled. Since this is more complicated than I would like to get I went back to the event driven version. I restructured a lot of things in the code to make it work smoother with the editor so hopefully this will not be a big deal.
This is how the code looks now for a simple plugin:
// Simple plugin code that makes mesh
using UnityEngine;
[RequireComponent(typeof(QuickRope2))]
public class SimplePlugin : Monobehaviour
{
// I know the following 2 functions are a bit dirty
// but in the long run they work fine.
QuickRope2 rope;
void OnEnable()
{
rope = gameObject.GetComponent<QuickRope2>();
rope.OnInitializeMesh += OnInitializeMesh();
}
void OnDisable()
{
// Make sure you remove the reference to the
// function when your done with the script
rope.OnInitializeMesh -= OnInitializeMesh();
}
void OnInitializeMesh()
{
// Do some special rope mesh building crap
// use "rope.Joints" to get the joint gameobject list
// use "rope.JointNormals" to get the joint directions
// use "rope.JointPositions" to get the positions on spline
}
}
FINALLY:
I am hoping to release the next BETA this week!
Jake Fletcher
QuickRopes2 Update 1-31-13
Hello friends!
FEATURE UPDATE:
The past few weeks have been busy but I have managed to squeeze a small about of development time in for QuickRopes2! I am proud to announce that QuickRopes2 has implemented Unity’s cloth physics! To use the cloth mesh in QuickRopes2 simply check the box “Use Cloth Mesh” in the “QuickRopes2Mesh” rope script and presto.
CODE ARCHITECTURE:
When I first started developing QuickRopes2 I was using an event system to trigger outside scripts. For Example
// Add your event to the QuickRopes2 master script
void Start()
{
QuickRopes2.SpecialEvent += myEventMethod;
}
void myEventMethod(QuickRope2 rope)
{
rope.MakeMeshStuffHappen();
}
The problem with doing this is that you now have messy code! And not only that, you would also have to add [ExecuteInEditMode()] to the top of your scripts to make it play nicely with the editor scripts.
So then I moved on to the SendMessage method that Unity Impliments. This allowed your code to look like the following:
// Kind of ugly and it's really anyone's guess as how to implement this.
void MethodCalledByQuickRopes2Script(QuickRopes2 rope)
{
}
This looks MUCH better than the code before! The problem with this code though is that it would also require the use of [ExecuteInEditMode()] at the top of all scripts in order for it to play nicely with the editor script.
Lastly is some code I have tried before and have opted to go back to. This code is much cleaner and enforces good design by the programmer who might mod and customize the rope scripts. This code will look like this:
// Make a script derive from the "RopeMeshPlugin" class. This class
// will be called by the parent QuickRope2 script without any need
// for the script to be a Monobehaviour. Thus eliminating the need
// to use [ExecuteInEditMode()]
public class MyMeshScript : RopeMeshPlugin
{
public coverride void GenerateMesh()
{
// This variable is automatically stored in the inherited class
// "RopeMeshPlugin"! So there is no need to pass variables
// through the method.
List<GameObject> jointsInRope = rope.Joints;
}
}
Another benefit to this final method is I am able to control the amount of plugins one can add. I do this by doing the following:
// Inside the QuickRope2 script
public RopeMeshPlugin meshPlugin;
public RopePhysicsPlugin physicsPlugin;
void GenerateRope()
{
// Do magical rope generation code here
if(meshPlugin != null)
meshPlugin.GenerateMesh();
if(physicsPlugin != null)
physicsPlugin.GeneratePhysics();
}
CONCLUSION:
I hope what I have shared in this update has shown that I am in fact still working on the QuickRopes2 plugin! I also hope it gives some insight into some of the decisions I make and why I make them. It typically boils down to making things simple for the users!
Jake Fletcher
Unity Assets
I have been working fiercely on getting the next iteration of QuickRopes finished! Also available is the 2D Volumetric Lighting kit!For more information please check out the Unity Assets page!
New Projects!
Want to know whats new at Reverie Interactive? Check out our new projects page to find out what kind of new cool things we are whipping up!
A New Look That is Easier To Manage
Please mind the mess and be patient. I tried to get everything back up and online before rush hour but there might be a few broken links. If you run into any of these links please feel free to contact me by clicking on the “Contact” tab in the top of this page.
Please stay tuned and be patient!
Jake Fletcher

