what tells us that this is in “second” ? (is M_PI*2 equal to 1 second? how?)
float32 maxRevsPerSecond = 7.0;
float32 accelerationFraction = acceleration.y*6;
float32 motorSpeed = (M_PI*2) * maxRevsPerSecond * accelerationFraction;
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
M_PIis the system’s definiton for the value of π (3.14159…) Thefefore,motorSpeedis an angular (rotational) value in radians per second.The above initial answer was only based on the variable names in the example code. Doing some net searching, I see this code is part of an example in the book Learning Cocos2D. In the section Making the Cart Move with the Accelerometer the book says: