Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

Character falls through spring (and floor sometimes)

$
0
0
Hi guys, could anyone help me out here? When my character touches a spring object, he flies up into the air as expected, but when he comes back down again, he falls through the spring and does nothing, i then have to get my character to walk outside the object then back in again to activate it. what am i doing wrong? using UnityEngine; using System.Collections; public class Spring : MonoBehaviour { public GameObject player; private Rigidbody RbPlayer; public int springAmount; //private bool springHit = false; // Use this for initialization void Start () { RbPlayer = player.GetComponent(); } void OnTriggerEnter(Collider other) { if (other.tag == "Spring") { // springHit = true; RbPlayer.AddForce (new Vector3 (0, springAmount,0)); } } }

Viewing all articles
Browse latest Browse all 1264

Trending Articles



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