Giter Club home page Giter Club logo

unity3druntimetransformgizmo's Introduction

Unity3DRuntimeTransformGizmo

A runtime transform gizmo similar to unitys editor so you can translate (move, rotate, scale) objects at runtime.

Video demonstration - https://www.youtube.com/watch?v=IUQqhS8tsNo

cyrilBoucher created a fork that works with Unitys PackageManager - https://github.com/cyrilBoucher/Unity3DRuntimeTransformGizmo/tree/feature/upm-package

I also just found that unity seems to be working on a runtime editor, though it currently still seems buggy and doesnt feel that great. https://github.com/Unity-Technologies/giles


WARNING - There is a bug in unity 5.4 and 5.5 that causes InverseTransformDirection to be affected by scale which will break negative scaling. Not tested, but updating to 5.4.2 should fix it - https://issuetracker.unity3d.com/issues/transformdirection-and-inversetransformdirection-operations-are-affected-by-scale

I have also ran into a unity bug (Unity 2017.2.0f3 (64-bit)) where when rotating a object (it was skewed, not sure if that matters) it will sometimes not have its mesh collider updated or something, causing me to not be able to click it again in certain spots until I disable and reenable the mesh collider in the inspector. Reenabling the mesh collider also updated where unity saw the center of the object to be. Maybe related to this bug? https://issuetracker.unity3d.com/issues/colliders-are-not-updating-to-match-attached-gameobject-location

There is also a bug where if you have multiple objects selected in the unity editor and then you select the last selected of those selected objects, unity will start throwing the error "type is not a supported pptr value UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)" It seems to be the mesh renderer in the inspector is having issues realizing that we added a new material to it (the highlight selected material). If you collapse the mesh renderer, the errors will stop.


Just place the TransformGizmo on a gameobject with a camera. Objects must have a collider on them to be selected.

Could use some work with how the moving is being handled. For example, I dont like how if you try to move something towards the camera, you cant get it to move past you to behind.

Added a pivot center mode so you can translate based on the Renderer.bounds.center instead of the normal pivot point.

Good news is that I have the code to replace using temporary parent gameobjects as a pivot with the same accuracy. Bad news is that it seems using a parent gameobject as a pivot, even when placed at the center of the desired object, does not give the same result as unitys Center mode. This leaves us wondering what unity is doing differently in Center mode. Either way, I am going to completely remove the temporary gameobject since its no longer needed, as well as put 2 Scale types that people can switch between. One scale type called "ScaleFrom" being like using a parent gameobject as a pivot, and one scale type called "ScaleFromOffset" being like unitys Center mode (though a bit inaccurate with skewed objects).

I talk about this more in this thread https://forum.unity.com/threads/scale-from-a-point-other-than-pivot-almost-working-code.544302/#post-3591286

There may also be some differences between unity and how I have things set up currently in regards to Center pivots, such as unity seems to use colliders first to find how much weight the object has or something to decide how much it effects the center, but for now we only look at the Renderer.bounds.center, so expect some differences between unity.

Also Added the ability to select multiple objects =)

Added a UndoRedo system. By default the keys to Undo is Shift+Z and Redo is Shift+Y We use Shift instead of Control so that while in the editor we dont accidentally undo editor changes (for some reason unity doesnt seem to give us the option to disable editor hotkeys while in play mode? https://issuetracker.unity3d.com/issues/disable-editor-keyboard-shortcuts-while-playing)

Added ability to give your own custom Gizmo meshes with the TransformGizmoCustomGizmo component. Just drop the TransformGizmoCustomGizmo in the scene and assign the inspector values.

unity3druntimetransformgizmo's People

Contributors

hiddenmonk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unity3druntimetransformgizmo's Issues

Show multiple Gizmo

Is there any way available to display multiple gizmo on different objects. I mean simultaneously show more than one gizmo?

Gizmo appearing on pivot, not actual mesh center

Hi Monk,

Your work is fabulous. I am using your package in our software. We will definitely give you credit once work is done.

I need one help. Currently, the gizmos appearing at target.position. Instead, I want gizmo to appear here:
targetRenderer.bounds.center
if renderer exists.

Can you please help us customise it. Many thanks!

VR Support?

Hi,

I'd like to know if it can work with VR (Oculus, VIVE and WaveSDK) and if you have any pointers for me if it doesn't have the capability now. I'll try to work it out and might provide you a PR if you're interested in extending this further.

Web GL performance

Good evening,

I've integrated the gizmo into my project (just need it for a simple use case) and everything works just fine while trying it out in the Unity Editor... however, when I built the project (it's a WebGL project), the moment the Gizmo shows up fps just drop like crazy making the app unusable. While testing on the editor, the performance hit is minimal, maybe 0.1-0.2 ms.

Any clue what might be causing that? I'm kind of clueless to be honest.

Thanks.

Line is too thin

Is there an easy way to make the lines thicker? I think they are not that easy to see

Help with the Undo system

Thank you for this great tool! I've been trying hard to expand the Undo system to include deleting/undeleting but it's beyond my skill, is anyone up to the task?

Rect tool?

Could you please make a Rect tool equivalent? Or do you have any idea of how to make it? I really need some guidelines. Truthfully, I just don't know how Unity's Rect tool works at all. I've played with it for a while (with both 3D and UI objects, single and multiple selection), I've read Unity API document, searched the forum and anywhere I could, but still no clue.

I appreciate any information on this issue. It's not very urgent atm, but I'll need it really bad in the next 2 months or so.

Shaders not working in URP.

It seems like the shader for the outline is not working for URP. Version 10.3.2, Unity 2020.3.1f1

The gizmo seems to work well but I get the pink default material when selecting an object to transform. Any help would be appreciated.

image

HDRP Unity 2018

Hi,
In Unity 2018 HDRP there is no gizmo at runtime. I tried to create shaders in shader Graph but even there is no error the controls doesn't draw. Is there a way to fix it?

TransformGizmo - Through / Over UI Issue (IsPointerOverGameObject)

Hi,
I've work with this asset and find out that the method GetTarget() - TransformGizmo.cs going through the UI elements

Here my solution if you need it:
I'm sure there is a better option to do that but it's working as expected now

Hope you find it useful

void GetTarget() {
	if (nearAxis == Axis.None && Input.GetMouseButtonDown(0))
	{
		bool isAdding = Input.GetKey(AddSelection);
		bool isRemoving = Input.GetKey(RemoveSelection);
		RaycastHit hitInfo;
		if (Physics.Raycast(myCamera.ScreenPointToRay(Input.mousePosition), out hitInfo, Mathf.Infinity, selectionMask))
		{
			if (!EventSystem.current.IsPointerOverGameObject())
			{
				Transform target = hitInfo.transform;

				if (isAdding)
				{
					AddTarget(target);
				}
				else if (isRemoving)
				{
					RemoveTarget(target);
				}
				else if (!isAdding && !isRemoving)
				{
					ClearAndAddTarget(target);
				}
			}
			else
			{
				ClearTargets();
			}
		}
		else
		{
			if (!isAdding && !isRemoving)
			{
				ClearTargets();
			}
		}
	}
}

Gizmos do not apppear

I have tried the package / the original github repo and the handles work and al but the gizmos don't appear
I am using unity 2020.1.9f1
With the example scene and the URP render pipeline

Rotation circles reset after rotation is applied

Hi,
I don't know if this is a bug or intended behavior, but when you start rotating an object along one axis, circles follow that rotation. But as soon as I let go, they restore to original position, even thought rotation is still applied to the object.
Even if this is intended behaviour, could you provide patch code for that? Or introduce settings that toggles this behavior.

Rotation

Thanks,
Vjekoslav

Rotation arrows

Hey,

Sorry this is hopefully my last question for a loooong time =D.

How can I made the rotation arrow of the first picture into the second picture. The protrusions have to turn around with the movement you make

screenshot_2
screenshot_1

Fixed step movements

Hey!

Sorry to knock at your doors again, but is there a way we could have the translation of movements in certain steps ? i.e dragging the handle would only move the object in particular (hardcoded) steps , say a float value of 0.5f in case of movement and scale, similarly a particular angle for rotation ?

This would make it look stutter a bit, but that is what i would like to have.

Thanks again..

Orthographic support

Hi,
I notice that gizmo not scale correctly on camera with orthographic projection.

Raycasts passing through the handles

If we have a gizmo on an object , and there's another object right beside the previous one, while trying to drag the first object through its gizmo handle , we seem to select the next object as well.

Also , if two of the gizmo handles are overlapping, it becomes unpredictable which one gets selected

Undo/Redo not work with UI button

Hi, Tried to use undo/redo function with UGUI button but not work, the UndoRedoManager.Undo(); or Redo() not work.
Tried to modify Updaate function too like `void Update()
{
HandleUndoRedo();

		if(!undo || !redo){

			SetSpaceAndType();
			
			if(redo)
			{
				UndoRedoManager.Redo();
				
			}
		
			if(undo)
			{
				UndoRedoManager.Undo();
				
			}

			if(manuallyHandleGizmo)
			{
				if(onCheckForSelectedAxis != null) onCheckForSelectedAxis();
			}else{
				SetNearAxis();
			}

			GetTarget();

			if(mainTargetRoot == null) return;
		
			TransformSelected();	
		}
	}`

Same object back to first pos and after impossible to select it...
Please How can I use undo/redo with UI ?

Best,

Undo function is not working properly

I have tried multiple times in the game view, whenever I move one object from 1 place to another place, and when I press undo button, the system simply selects the wrong object, which is not selected before. Please suggest to me how I can fix that?

Triangles for rotate lines

Can you help me with add a triangle for the rotate lines. When i copy and paste it from the move lines it is not working. And can I make the scale of the round lines smaller?

Multi-Axis movement support.

First of all I love the work you put into this framework, it suits my needs almost perfectly.
The only thing missing for me is a possibilty for multi axis movement.

This is what I am looking for:
XsguJ8VXdj

Are you looking to support this kind of feature anytime soon?

Help collision

I am impressed how well this gizmo works.

I just want to know how I can detect a collision with this gizmo. As you see in the video, my game object vibrates when it hits the wall or the ground. Also, the gizmo itself does not stop moving when the game object touches a wall or the ground. Do you know a solution for both problems? Thanks in advance!

Video: https://gph.is/2QE3RBr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.