Rolling BB-8 droid type Of Character

floatingwoofloatingwoo Los Angeles, Calif.Member Posts: 393

Hi, I've been playing with this little character. And I was hoping to hook him up to some code that would have him move like the robot on the new star wars. The ball underneath rolls when it moves, while the head stays more or less in the top position although it would be effected by motion velocity. When it moves forward the head rotates back, while it's rolling the head comes back to center, when it comes to a stop the head would rotate forward and then come to center. I guess a google search of the the robot in action would say more than my trying to explain.

«1

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
  • floatingwoofloatingwoo Los Angeles, Calif.Member Posts: 393

    Cool! That's a start.Thanks

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    I got curious -- here is a refinement of the technique.

  • floatingwoofloatingwoo Los Angeles, Calif.Member Posts: 393

    @RThurman Brilliant! I will share when I get the animation hooked to it. Thanks

  • floatingwoofloatingwoo Los Angeles, Calif.Member Posts: 393
    edited June 2015

    @RThurman Hi, I got a chance to play with the demo you provided. I have a question I want the ball to rotate when it moves.
    I used...
    When: mo.Lin.Vel.X >= to 1 Rotate
    I fear this was to simplistic. How can I get the ball to rotate the other way?...http://tinypic.com/m/ixbkf8/2

    I should probably go ahead and make an idle animation with him looking at us for when he is still,and then flip the graphic when he goes the other way.

  • owen_dennisowen_dennis Just a guy, you know. Member, PRO Posts: 236
    edited June 2015

    @RThurman said:
    I got curious -- here is a refinement of the technique.

    Oh wow, I've been making something that has been sort of faking that movement by using "rotate to". This might be perfect for what I'm making as well. Thanks!

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    edited June 2015

    @floatingwoo -- To get the ball to rotate, its probably easiest to use a rotate behavior (clockwise). If you are using the demo, make the speed = game.bodyVelocity

    Edit: Oh wow. I just found the animation you posted above. That really will look good. Yes, just use the rotate behavior. If the ball is about 100 pixels wide, make the speed self.Motion.Linear Velocity.X and it should work OK.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @owen_dennis -- Great! I hope it works for you.

  • SocksSocks London, UK.Member Posts: 12,822
    edited June 2015

    @RThurman said:
    floatingwoo -- To get the ball to rotate, its probably easiest to use a rotate behavior (clockwise). If you are using the demo, make the speed = game.bodyVelocity

    Edit: Oh wow. I just found the animation you posted above. That really will look good. Yes, just use the rotate behavior. If the ball is about 100 pixels wide, make the speed self.Motion.Linear Velocity.X and it should work OK.

    Or - for a 100 pixel diameter circle - you could constrain the rotation to self.Position.X *-1.14591559026165

    Rotate @ game.bodyVelocity/self.Motion.Linear Velocity.X would be out by a little bit (you want 314.15 x pixels per 360° degrees rather than 360 x pixels per 360° ) . . . goes to bed feeling smug about himself for adding something (probably wrong :) lol) to one of RThurman's pieces of maths :wink:

  • SocksSocks London, UK.Member Posts: 12,822

    @RThurman said:
    I got curious -- here is a refinement of the technique.

    P.S More fantastic stuff !

  • floatingwoofloatingwoo Los Angeles, Calif.Member Posts: 393
    edited June 2015

    @RThurman @Socks New RatBall. Still needs a little finesse but it looks pretty good thanks!
    http://tinypic.com/m/ixccr9/2 wait for the blink.

    Edit_ I could not do this in the latest version of game salad, the animation window goes blank and when I tried to scroll up and down in the behaviors window things started strobing out. I used 12.10 .

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @Socks said:
    Rotate @ game.bodyVelocity/self.Motion.Linear Velocity.X would be out by a little bit (you want 314.15 x pixels per 360° degrees rather than 360 x pixels per 360° ) . . . goes to bed feeling smug about himself for adding something (probably wrong :) lol) to one of RThurman's pieces of maths :wink:

    I guess I used the wrong trig formula. You are probably more familiar with SOHCAHTOA.
    Well... I was using TLAR.

    It stands for "That Looks About Right."

    (I guess I should stick with standard math.) :)

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    @RThurman said:
    I got curious -- here is a refinement of the technique.

    This is brilliant! Excellent demo, sir!

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @floatingwoo said:
    RThurman Socks New RatBall. Still needs a little finesse but it looks pretty good thanks!

    Yes, its a really nice effect! Its always stunning (for me) to see how powerful some nicely done graphics/animations can be. This is especially true for someone like me who has absolutely no graphic design skills. Even the blink brings life to the character and enhances the effect.

    Perhaps this will pave the way for a few good Star Wars related games that feature a BB-8 droid.

  • floatingwoofloatingwoo Los Angeles, Calif.Member Posts: 393
    edited June 2015

    @RThurman @Socks Hey, you have been a big help. I have another little something I would like to add to this little guy, and this may get a little tricky. I would like to add a feather or an antenna on the top that responds to the motion of the ball sort of like my little .gif here....

    Edit_ Animating it may be easier. But it would be cool if it were coded. Thanks

  • SummationSummation Member, PRO Posts: 476

    @RThurman said: I guess I used the wrong trig formula. You are probably more familiar with SOHCAHTOA.
    Well... I was using TLAR.
    It stands for "That Looks About Right."
    (I guess I should stick with standard math.) :)

    http://www.mathwords.com/s/sohcahtoa.htm

    SOHCAHTOA
    A way of remembering how to compute the sine, cosine, and tangent of an angle.
    SOH stands for Sine equals Opposite over Hypotenuse.
    CAH stands for Cosine equals Adjacent over Hypotenuse.
    TOA stands for Tangent equals Opposite over Adjacent.

  • SocksSocks London, UK.Member Posts: 12,822
    edited June 2015

    @RThurman said:
    Well... I was using TLAR.

    I works pretty good just eyeballing it, you wouldn't notice the very slight slip, especially on circles without markings near their edge.

  • SocksSocks London, UK.Member Posts: 12,822

    @floatingwoo said:
    . . .a feather or an antenna on the top that responds to the motion of the ball . . .

    I think the antenna would really be responding to the movement of his lower body as he kicks the ball ?

  • SocksSocks London, UK.Member Posts: 12,822

    @Summation said:
    TOA stands for Tangent equals Opposite over Adjacent.

    I've never really bothered with all that stuff, once you start introducing hypotenuses and adjacents it all starts to drift away from everyday language (and thinking), I prefer to see a moving triangle . . . hold on, demo time . . .

  • SocksSocks London, UK.Member Posts: 12,822
    edited June 2015

    @Summation

    Here you go (file attached) - drag the white marker on the outer circle around to any angle you want, and the length of both cosine and sine will be shown next to the vertical and horizontal lengths of the triangle.

    Personally I think with this 'view' of trigonometry you can do 90% of useful trig stuff within GameSalad - the only other idea that I might add that is useful is that of isolating the sine by itself, and making the X coordinate (previously following the cosine function) a constantly increasing or decreasing value, which gives us a sine wave, which is useful for all sorts of GameSalad related fun !

    The angle is quantised to 5° increments, you can switch this off in the Grabber's rules.

  • jay2dxjay2dx Member Posts: 611

    I've been making a game with this little type character for a while now, launching when star wars does :) anyways, bb8s head actually moves forwards when traveling forwards! not to the rear of bb8

  • floatingwoofloatingwoo Los Angeles, Calif.Member Posts: 393

    @RThurman @Socks I was thinking of adding an antenna that would react to the motion, kind of like this...http://tinypic.com/m/ixci90/2

  • floatingwoofloatingwoo Los Angeles, Calif.Member Posts: 393

    @jay2dx Lets see it!

  • floatingwoofloatingwoo Los Angeles, Calif.Member Posts: 393

    Ok, moving on.....http://tinypic.com/m/ixcj8h/2

  • SocksSocks London, UK.Member Posts: 12,822

    Looking great ! just need to stick the base of the antenna to the little guy's head !!

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @jay2dx said:
    I've been making a game with this little type character for a while now, launching when star wars does :) anyways, bb8s head actually moves forwards when traveling forwards! not to the rear of bb8

    Thats sort of true. The droid does not need to move its head in the direction of travel. But in some scenes, it is used that way to give the prop some expressiveness. But there are other scenes where it is moving at its fastest with the head sitting straight on top. (Which is done to express flight -- run away!)

    The demo originally had the ability to position the head to any angle, (which you can see in the "bobblehead" demo). But I took it out because @floatingwoo wanted it to be reactive. He wanted the whiplash effect.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @Braydon_SFX said:
    This is brilliant! Excellent demo, sir!

    Thanks! Isn't GameSalad incredibly versatile?!

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Its looking good!

    While adding the antenna as a seperate actor is doable. I am not sure it will have the effect you want. It would be the original "bobblehead" effect.

    To get the 'body' of the antenna to be bendable would require joints. And while doable, it would eat up lots of processing power. (I had always hoped that GS would eventually incorporate box2D joints. But it has never happened.)

  • SocksSocks London, UK.Member Posts: 12,822

    @RThurman said:
    Thanks! Isn't GameSalad incredibly versatile?!

    No, it's your processing of maths !

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @Socks said:
    No, it's your processing of maths !

    Well.... thanks, though I am not very good at math. But I do know how to read an equation off the internet!

    Honestly, the thing that makes GameSalad great is the ease with which just about any geometry equation can be implemented. They really designed GameSalad just right. (Well, almost just right. That expression editor does need to be expandable.)

    This, along with the very intuitive message that the UI implies makes GameSalad a great product for teaching (and learning) game development.*

    *This message was brought to you by the GameSalad For The Greater Good Society.

Sign In or Register to comment.