- Home /
Question by
TRBenny · Jan 31, 2017 at 10:01 AM ·
scripting problemscripting beginnershootingkinectgesture
Shooting with get joint rotation .eulerAngles kinect
Hi, my Demo Character, that is now connected and working with a kinect, shot physics balls from the palm, to hit some physical cylinder, and it works. The problem is that I'm trying to connect the "trigger" with the opening and closure of the hand.
Here is what I'm using:
public Rigidbody projectile;
public Transform shotPos;
public float shotForce = 1000f;
public float moveSpeed = 10f;
public Transform getHandRotation;
public void UpdateAvatar(Int64 UserID)
{
float h = Input.GetAxis ("Horizontal") * Time.deltaTime * moveSpeed;
float v = Input.GetAxis ("Vertical") * Time.deltaTime * moveSpeed;
transform.Translate (new Vector3 (h, v, 0));
if (getHandRotation.transform.rotation.eulerAngles.z > -50)//-94.94701
{
Rigidbody shot = Instantiate(projectile, shotPos.position, shotPos.rotation) as Rigidbody;
shot.AddForce(shotPos.forward * shotForce);
}
When I use in the ".eulerAngle.z", the symbol ">" it constantly shot, vice versa, if I put "<" he never shot. But with the closed hand the z value is something like -90° and when is open is not less than something like -30° to 20°. Where am I wrong?
Comment