Hi all,
making progress but I’m stumped again.
My gryocopter refuses to roll. I have the pitch and yaw working fine, but it flat out refuses to roll. Can someone look over my script and tell me where I went wrong?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;
public class gyroplayer : MonoBehaviour
{
[Tooltip(“In meters per second”)][SerializeField] float speed = 20f;
[Tooltip(“In meters”)] [SerializeField] float xRange = 10f;
[Tooltip(“In meters”)] [SerializeField] float yRange = 5f;
Have you checked your values in the Inspector? Have you rewatch the video at least one more time? Have you tried to comment out the pitch and the yaw to make the roll work independently?
Hi Nina,
I have tried playing about with the settings in my inspector, and just get wild results for pitch and yaw, nothing at all seems to affect the roll. I tried commenting the code for pitch and yaw out, but roll still stubbornly refuses to work. I’ve watched that section of the lesson about 20 times now, and am at a loss!
here is my processRotation
Set pitch and yaw to 0 in your processRotation method, and log the roll value into your console. This way, you can see whether the roll itself works. If it does, test yaw and pitch separately.
If all of them work, combine two. If they work, add the third one.
This way, you can narrow down the problem. At the moment, there are three different things that could cause the issue, and it is impossible to tell which one it is, or if two or three are causing the issue, or the combination of the three.
Hi Nina,
okay, so I did that, and the console records a roll of zero, so it’s definitely not doing anything at all. Pitch and yaw work just fine, simply no roll at all.
For what exactly does the console show 0? For float roll = xThrow * controlRollFactor;? If so, log the two variables on the right-handed side of the equal/assign sign into your console. One or both of them must be 0.
Oh, I think I’ve spotted the issue. Do you know what a local variable is? If not, please look it up after you figured out which variable is 0.