Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Assets/FingersLite/Demo/DemoScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private GameObject CreateAsteroid(float screenX, float screenY)

o.GetComponent<Rigidbody2D>().angularVelocity = UnityEngine.Random.Range(0.0f, 30.0f);
Vector2 velocity = UnityEngine.Random.insideUnitCircle * UnityEngine.Random.Range(0, 30.0f);
o.GetComponent<Rigidbody2D>().velocity = velocity;
o.GetComponent<Rigidbody2D>().linearVelocity = velocity;
float scale = UnityEngine.Random.Range(1.0f, 4.0f);
o.transform.localScale = new Vector3(scale, scale, 1.0f);
o.GetComponent<Rigidbody2D>().mass *= (scale * scale);
Expand Down Expand Up @@ -99,7 +99,7 @@ private void BeginDrag(float screenX, float screenY)
if (hit.transform != null && hit.transform.gameObject.name == "Asteroid")
{
draggingAsteroid = hit.transform.gameObject;
draggingAsteroid.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
draggingAsteroid.GetComponent<Rigidbody2D>().linearVelocity = Vector2.zero;
draggingAsteroid.GetComponent<Rigidbody2D>().angularVelocity = 0.0f;
}
else
Expand Down Expand Up @@ -130,7 +130,7 @@ private void EndDrag(float velocityXScreen, float velocityYScreen)
Vector3 origin = Camera.main.ScreenToWorldPoint(Vector3.zero);
Vector3 end = Camera.main.ScreenToWorldPoint(new Vector3(velocityXScreen, velocityYScreen, 0.0f));
Vector3 velocity = (end - origin);
draggingAsteroid.GetComponent<Rigidbody2D>().velocity = velocity;
draggingAsteroid.GetComponent<Rigidbody2D>().linearVelocity = velocity;
draggingAsteroid.GetComponent<Rigidbody2D>().angularVelocity = UnityEngine.Random.Range(5.0f, 45.0f);
draggingAsteroid = null;

Expand Down
Loading