Let me give you a hand.

View previous topic View next topic Go down

Let me give you a hand.

Post by DanielLC on Thu Oct 28, 2010 6:48 pm

I made this mainly to show off my Jetcalc script. You will need that in order to use this.

It's inspired by the Master Hand from the Super Smash Brothers series. It doesn't do much at the moment. I haven't even given it angular friction, so it will tend to rotate a bit too much.

Edit: Now it can move up and down (A and S) and grab and ungrab (X and Z).



Code:
Val {
  JO1(default=0,min=-1000000,max=1000000)
  JO2(default=0,min=-1000000,max=1000000)
  JO3(default=0,min=-1000000,max=1000000)
  JO4(default=0,min=-1000000,max=1000000)
  JO5(default=0,min=-1000000,max=1000000)
  JO6(default=0,min=-1000000,max=1000000)
  JO7(default=0,min=-1000000,max=1000000)
  JO8(default=0,min=-1000000,max=1000000)
  JO9(default=0,min=-1000000,max=1000000)
  JO10(default=0,min=-1000000,max=1000000)
  JO11(default=0,min=-1000000,max=1000000)
  JO12(default=0,min=-1000000,max=1000000)
  JO13(default=0,min=-1000000,max=1000000)
  X(default=0,min=-5,max=5,step=1,default=0)
  Y(default=49,min=-1000000,max=1000000)
  Z(default=0,min=-5,max=5,step=1,default=0)
  X0(default=0,min=-1000000,max=1000000)
  Y0(default=60,min=-1000000,max=1000000)
  Z0(default=0,min=-1000000,max=1000000)
  AX(default=0,min=-1000000,max=1000000)
  AY(default=0,min=-1000000,max=1000000)
  AZ(default=0,min=-1000000,max=1000000)
        t(default=0)
        k01(default=45,min=0,max=90)
        k02(default=10,min=0,max=90)
        k03(default=10,min=0,max=90)
        k04(default=-10,min=-90,max=90)
        k05(default=150,min=90,max=180)
        k11(default=10,min=0,max=90)
        k12(default=10,min=0,max=90)
        k13(default=10,min=0,max=90)
        k21(default=10,min=0,max=90)
        k22(default=10,min=0,max=90)
        k23(default=10,min=0,max=90)
        k31(default=10,min=0,max=90)
        k32(default=10,min=0,max=90)
        k33(default=10,min=0,max=90)
        k41(default=10,min=0,max=90)
        k42(default=10,min=0,max=90)
        k43(default=10,min=0,max=90)
  REST(default=1,min=0,max=1)
}
Key {
  0:Z(step=-1)
  1:Z(step=1)
  2:X(step=1)
  3:X(step=-1)
  4:REST(step=0.1)
  5:REST(step=-0.1)
  7:Y(step=0.3)
  8:Y(step=-0.3)
}
Body {
  Core(){
          N:Chip(angle=k21){
            N:Chip(){
              N:Chip(angle=k22){
                N:Chip(){
                  N:Chip(angle=k23){
                  }
                }
              }
            }
          }
    S:Chip(){
    S:Chip(){
    S:Chip(){
      W:Jet(name=ji7,power=jo7){
        N:Chip(){
        N:Chip(){
        N:Chip(){
          N:Jet(angle=k11,name=ji8,power=jo8){
            N:Chip(){
              N:Chip(angle=k12){
                  N:Jet(name=ji4,power=jo4,angle=k13){
                  }
              }
            }
          }
        }}}
      W:Rudder(angle=k05){
        E:Jet(name=ji2,power=jo2,angle=k01){
          S:Rudder(angle=k04){
            S:Chip(angle=k02){
              S:Chip(){
                S:Jet(name=ji6,power=jo6,angle=k03){
                }
              }
            }
          }
        }
      }
      }
      E:Chip(){
        N:Chip(){
        N:Chip(){
        N:Chip(){
          N:Jet(angle=k31,name=ji5,power=jo5){
            N:Chip(){
              N:Chip(angle=k32){
                  N:Chip(angle=k33){
                  }
              }
            }
          }
        }}}
      E:Jet(name=ji1,power=jo1){
        N:Chip(){
        N:Chip(){
        N:Chip(){
          N:Chip(angle=k41){
              N:Chip(angle=k42){
                  N:Jet(name=ji3,power=jo3,angle=k43){
                  }
              }
          }
        }}}
      }
      }
    }}}
  }
}
Lua
{
require("DanielLC/jetcalc.lua")

function rest()
  return {
  45,
  10*(1+math.sin(T)),
  10*(1+math.sin(T)),
  -10,
  150,
  10*(1.5+math.sin(T+0.5)),
  10*(1.5+math.sin(T+0.5)),
  10*(1.5+math.sin(T+0.5)),
  10*(1.3+math.sin(T+1)),
  10*(1.9+math.sin(T+1)),
  10*(1.9+math.sin(T+1)),
  10*(1.5+math.sin(T+1.5)),
  10*(1.5+math.sin(T+1.5)),
  10*(1.5+math.sin(T+1.5)),
  10*(1.5+math.sin(T+2)),
  10*(1.5+math.sin(T+2)),
  10*(1.5+math.sin(T+2))
  }
end

function hold()
  return {
    60,
    45, 45,
    -45,150,
    90, 60, 45,
    80, 90, 45,
    85, 60, 45,
    90, 45, 45
  }
end

function current(r,h)
  local p_rest = rest()
  local p_hold = hold()
  local p_cur = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

  for i = 1, 17 do
    p_cur[i] = r*p_rest[i] + h*p_hold[i]
  end
  return p_cur
end

function main()
  T=T+0.3
  pose = current(REST,1-REST)
  K01 = pose[1]
  K02 = pose[2]
  K03 = pose[3]
  K04 = pose[4]
  K05 = pose[5]
  K11 = pose[6]
  K12 = pose[7]
  K13 = pose[8]
  K21 = pose[9]
  K22 = pose[10]
  K23 = pose[11]
  K31 = pose[12]
  K32 = pose[13]
  K33 = pose[14]
  K41 = pose[15]
  K42 = pose[16]
  K43 = pose[17]

  dx=_X()-X0
  dz=_Z()-Z0

  deltax=20000*(X-dx*20)
  deltaz=20000*(Z-dz*20)

  X0=_X()
  Z0=_Z()

out(0,_WEIGHT())

  Ji={JI1,JI2,JI3,JI4,JI5,JI6,JI7,JI8}
  --Jo=jetcalc(Ji,{deltax,_WEIGHT()*50*(5-_H()),deltaz,-100000*_EX(),100000*_EY(),100000*_EZ()},8)
  Jo=jetcalc(Ji,{deltax/5000,10*(Y-_Y()),deltaz/5000,-100000*_EX(),100000*_EY(),100000*_EZ()},8)
out(3, _Y())
  JO1=Jo[1]
  JO2=Jo[2]
  JO3=Jo[3]
  JO4=Jo[4]
  JO5=Jo[5]
  JO6=Jo[6]
  JO7=Jo[7]
  JO8=Jo[8]
--[[  JO9=Jo[9]
  JO10=Jo[10]
  JO11=Jo[11]
  JO12=Jo[12]
  JO13=Jo[13] ]]--
end
}


Last edited by DanielLC on Thu Apr 07, 2011 1:30 pm; edited 3 times in total (Reason for editing : Made compatible with Jetcalc update)

DanielLC
Tank
Tank

Posts : 78
Join date : 2010-10-23

View user profile

Back to top Go down

Re: Let me give you a hand.

Post by bwansy on Fri Oct 29, 2010 12:15 am

This is incredible. Shocked

_________________
A.K.A. Bernard

bwansy
Admin

Posts : 170
Join date : 2010-07-15

View user profile http://rigidchips.forum-motion.com

Back to top Go down

Re: Let me give you a hand.

Post by DanielLC on Thu Apr 07, 2011 1:40 pm

Updated

DanielLC
Tank
Tank

Posts : 78
Join date : 2010-10-23

View user profile

Back to top Go down

Re: Let me give you a hand.

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum