Hello everybody! I am making a game where my player is looking through a camera. (Like fps, but more fp of fps.) My script is:
using UnityEngine;
using System.Collections;
public class jumpAfterTest : MonoBehaviour
{
public void JAT ()
{
Debug.Log("Me is JAT");
//add effect here
GetComponent().AddForce (transform.up * 1000);
}
}
It is unusual, I know, because it is triggered by:
using UnityEngine;
using System.Collections;
public class Test: MonoBehaviour
{
public jumpAfterTest _jumpAfterTest;
void OnMouseDown()
{
Debug.Log ("Mouse Down");
_jumpAfterTest.JAT ();
}
void OnMouseUp()
{
Debug.Log ("Mouse up");
}
}
As far as I can see, my addforce code is fine, but the jumpAfterTest script won't work. My camera that the script is attached to doesn't move. I don't know why it won't. jumpAfterTest is receiving input. Please help me out if you can. Is this AddForce not working because it is a camera it is attached to? Thanks. ( By the way, I am in ios)
↧