I'm working on a 2D scroller that has an slingshot mechanic (a boat in the main plane shooting at other boats on the background, kinda parallax), but I'm having a few issues on instantiating the projectiles while keeping their Physics and Rigidbody values. I have tried using prefabs, with no success. This is how the slingshot works. Can someone give me any pointers or ideas?
bola.isKinematic = false;
Vector3 curScreenPoint = new Vector3 (Input.mousePosition.x, Input.mousePosition.y, 1f);
Vector3 curPosition = Camera.main.ScreenToWorldPoint (curScreenPoint);
transform.position = curPosition;
void OnMouseUp ()
dir = sling.transform.position - transform.position;
dir = dir.normalized;
bola.AddForce (dir * 1250f);
spring.enabled = false;![alt text]
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
4 People are following this question.
Hi guys....i want to respawn the enemy every time it dies but it only respawns once after its death...code is given below
How to get out of a for loop after a number of child objects have been Instantiated
instantiate finding upstream velocity
Bullet Spawning Problem
How can i instantiate a mesh at a hit point?