Jump to content
Sign in to follow this  
ItsDangerous

Geometry jumping out of place with polybrush

Recommended Posts

To reproduce this, here are the steps:


1. open a new scene


2. import the latest polybrush 0.9.10b0 using unity 5.5.0f3


3. make a cube. scale it out and flaten to make the floor in the scene - set it to static


4. make a regular sized cube so it is casting a shadow on the floor (choose a non zero location like 2 meters away from zero). Paint half of this cube with a transparent color and the other with a solid. Set this to static as well. Close the polybrush window.


5. Set the sunlight to "bake". Wait for your scene to bake that shadow into the floor.


6. Hit play. Your cube mesh will appear somewhewere else while your collider of the cube stays in place. Doesn't matter what shader. They all seem to do the same. 


 


I am using Windows10


 


I even redownloaded polybrush right before typing this. Same result.


 


 


Also, here is a video: https://youtu.be/ECh7duN1u7g


 


- Mack


post-1469-0-33262400-1483058814_thumb.jpg

Share this post


Link to post
Share on other sites

Thank you for the detailed video.  That made it very easy to track the problem down.

 

I've patched the problem and will have an update in the store asap, but if you just want a quick fix here are the steps:

 

- Open ProCore/Polybrush/Code/Scripts/MonoBehaviour/z_AdditionalVertexStreams.cs

- Select all, replace with this code:

#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
using System.Collections;

namespace Polybrush
{
	/**
	 *	Workaround for bug in `MeshRenderer.additionalVertexStreams`.
	 * 
	 *	Namely, the mesh is not persistent in the editor and needs to be "refreshed" constantly.
	 *
	 *		- https://issuetracker.unity3d.com/issues/meshrenderer-dot-additionalvertexstreams-collapse-static-meshes
	 *		- https://issuetracker.unity3d.com/issues/api-mesh-cannot-change-vertex-colors-using-meshrender-dot-additionalvertexstreams
	 *		- https://issuetracker.unity3d.com/issues/meshrenderer-dot-additionalvertexstreams-discards-data-if-set-in-awake
	 *		- https://issuetracker.unity3d.com/issues/meshrenderer-dot-additionalvertexstreams-looses-color-fast-in-editor
	 */
	[ExecuteInEditMode]
	public class z_AdditionalVertexStreams : MonoBehaviour
	{
		public Mesh mesh = null;
		
		private MeshRenderer _meshRenderer;

		private MeshRenderer meshRenderer
		{
			get {
				if(_meshRenderer == null)
					_meshRenderer = gameObject.GetComponent<MeshRenderer>();
				return _meshRenderer;
			}
		}

		public void SetMesh(Mesh mesh)
		{
			this.mesh = mesh;
			meshRenderer.additionalVertexStreams = mesh;
		}

		void Update()
		{
			if(meshRenderer == null || mesh == null || EditorApplication.isPlayingOrWillChangePlaymode)
				return;

			meshRenderer.additionalVertexStreams = mesh;
		}
	}
}
#endif

Share this post


Link to post
Share on other sites

 

Thank you for the detailed video.  That made it very easy to track the problem down.

 

I've patched the problem and will have an update in the store asap, but if you just want a quick fix here are the steps:

Thankyou. That fixed the problem with my level geometry.  :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×