- Home /
Plain calculating operations? :o
i need some help with this, since it's not working =)
var speed_step1 = int.Parse(einlesewerte.vehicle_speed);
var speed_step2 = (speed_step1 / 300) * 180;
ANA_speed.transform.Rotate(0,speed_step2*Time.deltaTime,0);
if i rotate the object WITHOUT trying to do the math stuff on the variable it works fine :/
Answer by Bunny83 · May 13, 2011 at 11:19 AM
;) integer division problem... int / int == int.
Try
var speed_step2 = (speed_step1 / 300.0) * 180.0;
If that doesn't work do that in addition:
var speed_step1 : float = int.Parse(einlesewerte.vehicle_speed);
Answer by loopyllama · May 13, 2011 at 11:20 AM
it looks like speed_step1 is an int and speed_step2 is an int/int * int, so it is an int as well. try changing the 300 to 300.0
Your answer
Follow this Question
Related Questions
First algorythm, need help :/ 1 Answer
Find connections dont working 0 Answers
Room Path Generator 1 Answer
Real-time day/night system breaks after noon 1 Answer
Online Advanced AI(Artificial Intelligence) with JS 3 Answers