|
been looking for a way to do this but havent found it in c# pleas god some one help us. this is what we have so far for are character using UnityEngine; using System.Collections; public class carl : MonoBehaviour { public GameObject ProjectilePrefab; public float PlayerSpeed;
}
(comments are locked)
|
|
You can do this:
Call this from your player script. cool thanks but now i get an error 'MainCamera' does not exist in the current context any ideas
Oct 04 '10 at 11:57 PM
bryan
got it working but the player spins out of control and isnt looking at the mouse pointer position.
Oct 05 '10 at 12:05 AM
bryan
Did you call this from your players script?
Oct 05 '10 at 12:18 AM
IJM
yeah we added it in and the player immediately turned 90 deg and would run around and rotate, just not in the direction of the mouse position
Oct 05 '10 at 01:13 AM
bryan
You are doin something wrong. Can you put the whole player code down, with the implementation of this? (as a answe)
Oct 05 '10 at 12:13 PM
IJM
(comments are locked)
|
|
using UnityEngine; using System.Collections; public class carl : MonoBehaviour
{
public GameObject ProjectilePrefab;
public GameObject MainCamera;
} there it is, he moves, and rotates kinda randomly, but does not rotate to look at mouse postition it lost the top part here using UnityEngine; using System.Collections; public class carl : MonoBehaviour { public GameObject ProjectilePrefab; public GameObject MainCamera; public float PlayerSpeed; public float QuaternionSpeed;
Oct 05 '10 at 04:20 PM
bryan
You need something like this in your Start() function: MainCamera = GameObject.Find("CameraName"); You need to know what is the name of your camera in Editor. (CameraName)
Oct 06 '10 at 05:36 PM
IJM
(comments are locked)
|
