Quantcast
Channel: Latest Questions by CallToAdventure
Viewing all articles
Browse latest Browse all 62

Instantiate at position

$
0
0
I am trying to implement a simple throw-stone script and everything works fine But the position of the instantiated projectile. I am using mixamo animation events for this - and I am instantiating a projectile after 2 seconds (wher, in animation, the hand is in the last position to hold the stone). Here's what I came up with so far using UnityEngine; using System.Collections; public class InstantiateStone : MonoBehaviour { public Rigidbody stonePrefab; void Start() { StartCoroutine(waitSeconds(2.0f)); } IEnumerator waitSeconds(float seconds) { yield return new WaitForSeconds(seconds); Rigidbody MyProjectile; MyProjectile = Instantiate(stonePrefab, transform.position, transform.rotation) as Rigidbody; MyProjectile.rigidbody.AddForce(new Vector3(-2000,0,0)); } } I am not sure how to approach this, help is much appreciated!

Viewing all articles
Browse latest Browse all 62

Trending Articles



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