Welcome, Guest! Sign Up RSS

My site

Tuesday, 27.06.2017
Here is explanation the idea I used to make this.

Part I


        As you may see bike wheel has a round tire. And this is the main reason why bike is turning. Not because of rotation of front wheel(honestly, it's main reason of lean) but because of lean. So, I've made few standard Unity wheel controllers "around" my mesh wheel and changing it by javascript while leaning.

if (bikeXangle >=10 && bikeXangle <20){//наклон влево от 10 до 20 градусов, колесо L1 (10 градусов)
currentRearWheel = rearWheelL1;}
if (bikeXangle >=20 && bikeXangle <30){//наклон влево от 20 до 30 градусов, колесо L2 (10 градусов)
currentRearWheel = rearWheelL2;}
if (bikeXangle >=30 && bikeXangle <42){//наклон влево от 30 до 42 градусов, колесо L3 (12 градусов)
currentRearWheel = rearWheelL3;}
if (bikeXangle >=42 && bikeXangle <60){//наклон влево от 42 до 60 градусов, колесо L4 (18 градусов)
currentRearWheel = rearWheelL4;}
// для переднего колеса чуть иные значения наклона, так как всего 3 дополнительных колеса
if (bikeXangle >=10 && bikeXangle <24){
currentFrontWheel = frontWheelL1;}
if (bikeXangle >=24 && bikeXangle <40){
currentFrontWheel = frontWheelL2;}
if (bikeXangle >=40 && bikeXangle <60){
currentFrontWheel = frontWheelL3;}

        This is how it works in that version.