Jump to content

Photo

Kayla's Tutorial 01 - Cruise Control

- - - - -

  • Please log in to reply
4 replies to this topic

#1
Kalapixie

Kalapixie
  • VIP Passport
  • 28 posts
Hi, in this tutorial, I will be teaching basic controls, and a little bit of programming to make a toggle switch to have your rawbot move forward continuously.

Start by opening Rawbots, and tabbing into the world and into third person.

Spoiler


First, open your console by pressing ~ (tilde key). Then click on one of the motors on your rawbot. This will bring up a huge preprogrammed set of icons.

Spoiler


It's very complicated isn't it? Well, it's fairly simple. The input sampler takes in key presses, and then turns them into 1 (positive key press) or -1 (negative keypress). When you let go of either, it returns to 0. The input sampler then feeds it's output, into the sample mapper's input. The sample mapper basically extends the range of the input sampler. In the case near the bottom, the sample mapper controls the speed (-8, or 8) when you press W or S. Sweet right? But holding W or S for a long long time starts to hurt my fingers :(

So I'm going to teach you how to make a cruise control toggle key.

First, start by holding ctrl, and clicking somewhere near the top. You will see Oscillator in the console, press tab until you get to input_sampler, and then press enter/return. It will say 'Positive', press enter again to create a positive node. Once you have done so, set the positive node to 't'. Click on the input sampler again, and add attack and release. Attack is how long it takes (with lower being slower) to go from 0 to 1, or 0 to -1. Release is how long it takes once you've released the key, to return to 0. By setting these high (100), it will cause the input sampler to jump immediately to 1 when you press 't'. (Replace 't' with any key you want)

Finally, the input sampler needs to OUTPUT it's number. So click it once more, tab until you see sample. Press enter, and tada, your input sampler works.

Spoiler


So far, if you've followed up to this point, you should have an input sampler that turns to 1 when you press 't'. and back to 0 when you let go. Ctrl-click somewhere in the grid to add a new part. Tab until you get to toggle, and press enter. Add to the toggle (like you did with the input sampler), these four things. Selector, sample_a, sample_b, and sample. Set sample_a to 0, and sample_b to 1. Now ctrl-drag the Selector onto the sample originating from the 't' input_sampler. This will take the output of the input_sampler, and feed it into the toggle. If you've done it correctly, you should see the output of the toggle switch between 0 and 1 whenever you press t.

Spoiler


Now we're going to move the toggle a little over to the left, just do this by dragging.

Spoiler


Finally, we're going to make use of the toggle by using a sample_mapper. Ctrl-click on the grid, tab until you get to sample_mapper, and press enter. Add these things: sample, mapper_min, mapper_max, mapped, and the OUTPUT inverted (which will be the second one in the list, or it'll look like <invert, as opposed to >invert).

Assign -8 to mapper_min, and 8 to mapper_max. Ctrl-drag the input-sample to the output-sample of toggle. If you did it correctly, when you press t, you should see mapped skyrocket to 8, and then another press will drop it to 0. Inverted should be the opposite (-8, and 0).

Finally ctrl_drag the velocity of the motors to their respective mapped and inverted. Pay attention to where they are connecting to the bottom sample_mapper, and you should be good to go. If you make a mistake, hover over the velocity with your mouse, and press ctrl-backspace.

Spoiler


Once you've finished, close the console with the tilde key, and press 't' to start your toggled movement. As a note with your base robot, I'd suggest not having auto-run on and pressing W. Your bot will do a wheelie and then flip over pretty quickly. This is because the sample_mapper of W, and the sample_mapper of the toggle are added together, so your motor velocity becomes 16.

If you have any questions, just post them here and I'll see if I can help

- Melody

#2
McVladi

McVladi

    Mazinger

  • Developer
  • 149 posts
  • LocationEl Salvador
Awesome guide, good job!

#3
rbf192

rbf192
  • Members
  • 56 posts
  • LocationOn my MTB at the top of a mountain.
Awesome guide!

#4
Ryusho

Ryusho
  • VIP Passport
  • 87 posts
Now I just need some help with this dang water jet thruster thing....I got it attached but I cant move :( so I am stuck floating in the water X_X

#5
Xyceres

Xyceres
  • VIP Passport
  • 267 posts
  • LocationVictoria, Australia

Now I just need some help with this dang water jet thruster thing....I got it attached but I cant move :( so I am stuck floating in the water X_X

Make sure the actual thruster is underwater and if you maybe up the max thrust value of it.
Squish: Hello rozgo, would you like to confirm or deny rumours that you are a duck and/or an elf
rozgo: elf, definitely elf

Never trust an elf!