Creators – Week 2

Hi folks, this week we started our first project. We have a truck that can drive down a road, avoiding obstacles, or maybe not!

We created a new project in Unity, using the default 3D Core template, and called it Prototype 1.

We then downloaded and imported the assetpack from here: [Creators Teams Channel]

The asset pack already included an existing scene, which had a simple environment already. We them dragged in a vehicle and obstacle from the imported assets. Imported assets aren’t just models; they can contain Unity obstacles, such as colliders, already.

To make the truck move, we made a new C# script called PlayerController. The new C# files Unity creates always look the same (apart from the name of the Class, which matches the new file name):

We added the following code to the Update() method to change the transform of the vehicle:

    // Update is called once per frame
    void Update()
    {
        //  Move our vehicle forward
        transform.Translate(0, 0, 1);
    }

The Unity scripting documentation can be found:

https://docs.unity3d.com/ScriptReference/index.html

and the specific page for the Transform component is:

https://docs.unity3d.com/ScriptReference/Transform.html.

This method on the Transform component that we’re calling, Translate() has several forms. The one we’re using here expects us to provide X, Y, Z values. What we’re saying we want to happen is “Change the transform by moving it 1m in Z every frame.

When we run, the car moves very fast off the end of the road. That’s because we’re running at many frames a second. It’s too fast. Next week, we’ll look at making this frame rate independent and controlling the speed.

Finally, I’ve created a GitHub repo for our projects this year. Up-to-date versions of our projects will always be available here after our sessions: https://github.com/coderdojoathenry/Creators-2022

Bodgers – Getting started with Python

Hi Everyone

It was great to get back again with a full year to look forward to and it was also great to see so many people interested in getting involved with CoderDojo Athenry.

In the Bodgers group we got off to a great start, we installed the Mu Python editor, and we wrote our first few programs.

Bodgers

The Mu editor can be downloaded from here: https://codewith.mu/.

You can find our code from last Saturday on the last couple of slides from this week’s notes here: Bodgers Day 1

We also decided we’re going to do a few small projects between now and Halloween and then start on a bigger project after that.

Next week we are going to make a Space Invaders style game, you can find some images for it here: https://www.dropbox.com/home/Bodgers/Space%20invader/Images.

Looking forward to seeing you all next week.

Declan

Creators 2022/2023 – Resources

Here are links to a few resources we’re going to need this year:

You are going to need an email address so you can register for Unity and Microsoft.

Unity:

https://unity3d.com/get-unity/download

Install Unity Hub. Create a Personal account. Install the latest standard version of Unity version 2021.3. Include Visual Studio.

Teams: https://teams.microsoft.com/l/channel/19%3a87100ae29304432397b969f52a3bcc15%40thread.tacv2/2022%2520Projects?groupId=cedb60b0-c5f6-4f2e-a3b7-e4a14d09d9c5&tenantId=adf6361d-b4dc-42d2-b27a-9d409b9757c8

Click on the link. Log-in to your Microsoft account, or create one if necessary.

CoderDojo Athenry Returns on 01 October 2022!

poster 2 2022

CoderDojo Athenry is returning with our weekly sessions in Clarin College starting Saturday 01 October 2022.

Our sessions will take place between 2:00pm and 4:00pm.

We will run five groups this year Explorers, Advancers, Bodgers, Creators and Hackers.

There is more information about the groups, our location and everything else on our About page.

New members are always welcome. If you are aged between 7 and 17, just come along on the first day and fill out a registration form. Young people aged 12 and under have to be accompanied by a parent/guardian for the whole session.

And don’t forget, CoderDojo Athenry is run by volunteers and is completely free for participants — no membership fees, no weekly contributions.

You should bring a laptop if you have one, but we have some loaner laptops if you don’t.

Explorers

No code for this weeks session, as we will be having a party!!

We will supply food, but please BRING YOUR OWN DRINKS.

As each family has there own policy on fizzy drinks, sugar, caffeine etc it is best if everyone brings their own.

See you all Saturday.

Modellers – Weeks 5 & 6

We completed our dioramas with materials and lights and rendered the final images. Some people chose their own colours and some used a palette generator (see: https://coolors.co/bf4e30-c6ccb2-093824-e5eafa-78fecf) to choose a complimentary set of colours to provide a harmonious look for our scene.

We used the Cycles rendered and turned on the denoising options, which automatically remove any graininess from the resulting render, to give us a high-quality output in a reasonable timeframe.

We then built a simple model of an articulated desk lamp. Built as a single mesh and composed of simple primitive objects, all starting as cylinders or cubes, we developed it initially in a completely linear vertical configuration.

We then created vertex groups for each distinct portion of the lamp and assigned those parts of the lamp to those vertex groups. From the bottom up, these groups were:

  • base
  • pivot
  • upperarm
  • elbow
  • lowerarm
  • wrist
  • shade

We then added a spot light to represent the lamp’s bulb.

Next we generated a new armature. In edit mode, we scaled the initial bone until it was just the size of the base vertically and called it base, the name matching that of the vertex group in the lamp model. We then extruded the tip of this bone vertically to the centre of the first hinge pin in the model. This bone was named pivot again matching the name of the corresponding vertex group. We repeated this until there was a bone, named for the corresponding vertex group, across each section of the model.

We then returned to edit mode and, selecting first the armature and then shift-selecting the model, we used Parent | Armature Deform from the object menu to associated them together. The mesh became a child of the armature. Selecting the armature and changing to Pose mode, we were able to see how rotating the bones allowed us to move the model in a simple and non-destructive way.

We then wanted to move the light with the armature as well, as it currently remained in space where we’d located it originally. To do this we selected the spotlight object and added an object constraint tying it to the the shade bone in the armature, as shown below. This moved the light, so we needed to reposition and rotate it again to get it in the correct location.

The final step was adding an inverse kinematic control bone into the rig. Moving an inverse kinematic (IK) bone automatically moves all connected bones to try to follow the movement of the control bone. In the armature, in edit mode, we added a single bone and located it near the rim of the lamp shade. We called it “control” and, selecting it and then the shade bone, used Armature | Parent | Make | Keep Offset to join them.

We then switched to pose mode. Once in pose mode, we could add an IK constraint to the control bone as shown below. All defaults here are fine in this case.

Then we saw that moving this bone in Pose mode caused the rest of the lamp to follow, however some parts of the lamp were moving in ways we didn’t want. The final step was to place some IK limits on certain bones in the Bone Properties Panel. For the base we locked x, y and z because we didn’t want it to rotate at all:

For pivot and shade, we locked then in x and z, this will allow them to turn around their own axis but not bend over. For all the others we locked them in y and z allowing them to bend over corresponding to the way they were pinned in the model.

Files for these final models can be found on our Sharepoint site.