Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

Enemy throwing projectiles in an arc

$
0
0
Hi everyone. I'm pretty new to Unity and C# so I would be extremely grateful if you could help me with something. I'm trying to have an enemy shoot projectiles up in the air in an arc in 2D repeatedly. I've tried looking at the API and using a script someone else referenced but I've had no luck thusfar. I know how to spawn the projectile from an empty gameobject, I'm just really stuck on the throwing part. Here's what I've got: using UnityEngine; using System.Collections; public class Handcuffs : MonoBehaviour { public float thrust; public Rigidbody2D rb; void Start() { rb = GetComponent(); } void FixedUpdate() { rb.AddForce(transform.forward * thrust); } } However it doesn't do anything no matter which thrust value I assign it. Any tips would be much appreciated, thank you.

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>