Object flies off to infinity after rotation
I am trying to make a 2D "Ghost Object" in Unity that moves to where the player's mouse position is (while snapping to a grid) and rotates when the mouse wheel is rotated. When the player clicks, it would then create the "Real Object" in its place. The problem is that as I start rotating the object, it becomes inexplicably unstable and eventually flies off screen before reaching infinity. When not rotated, it behaves perfectly. Since the movement code should work regardless of direction, I have no idea why it is flying off screen. Relevent code (C#): Vector3 rawPos = cam.ScreenToWorldPoint (Input.mousePosition); transform.Rotate(0,0,50*Input.GetAxis ("Mouse ScrollWheel")); Vector3 targetPos = new Vector3 (Mathf.RoundToInt(rawPos.x),Mathf.RoundToInt(rawPos.y),10); transform.Translate (targetPos-transform.position); This is probably something obvious, but I'm still a bit new to this. Thanks in advance for any help. Edit: I suppose I should note that this is occurring in FixedUpdate.
Solved the problem by changing transform.Translate to transform.position = targetPos Works just as well.
Queue showing empty
Request.IsAjaxRequest() always returns false
How to Remove Apply Button in a Telerik RadColorPicker From Code Behind
Unable to cast object of type 'System.Data.Entity.Infrastructure.DbQuery`1' to type 'System.Collections.Generic.IEnumerable
Change Model Data In a Controller Method
Allow caller to supply LINQ predicate without knowing value
How to retrieve data from sql server database and manipulate it in c#?
How to publish the WSDL at the public domain name in a WCF service hosted in an Azure worker role?
Are PlaybackSettings persistent between tests?
When to use ref and out? [duplicate]
Authorize Attribute with Roles not working?
WebRequest will not pass headers
Delay in button activation in Asp.net
how to transfer data from HTML tag to c# in MVC
WPF Toolkit Chart using ControlTemplate don't show my LineSeries