Skip to content
Cawd Logo GAWD
  • Home
  • About
  • Assignments
  • Resources
  • Contact

Monday, March 14th

Monday, March 14th

Class hours: 9:40 – 2:05
Mr. Bohmann
wbohmann@ewsd.org

Today’s Notes

  • Today is an EHS B Day (is is also pi day 3.14)
  • Week Twenty Seven – now go get organized!
  • #802PhonesDownHeadsUp Contest Page – Submit if you are ready.
  • Student Leadership Committee meets today at 11:45 in the rink cafeteria
  • Step Up Day is Thursday – you do not have CTE Classes (but you may have EHS classes)
  • No School Friday or next Monday
  • Unity, your PSA and Skills will be the focus of this week.
  • Skills USA competition is Thursday, April 7th. That is three weeks and change from today!
  • Remote Link / Same as the one in Google Classroom

9:40 Attendance

9:45 Monday Mail

9:50 Unity – Creating Character Constraints – Raycasting – the limit the Jump

Unity 2D: Checking if a Character or Object is on the Ground using Raycasts

Raycasting in a 3D virtual world is like firing a laser from an origin point. In this project, you can use raycasting to determine whether or not the player is close to the ground. If the player is grounded they can jump, and if not, jumping is prevented. This will stop the player from being able to tap the jump key multiple times and prevent themselves from falling between platforms.

A raycast, or raycasting, is like firing an imaginary laser into your Unity Scene. This can be done in 3D or 2D, and each has their own set of methods. The 2D methods should be used for 2D games to reduce the complexity of the calculations required.

To fire a raycast, you can use the Physics2D.Raycast() method, which returns a struct of type RaycastHit2D when the raycast intersects a collider in the Scene. The RaycastHit2D struct contains properties that can tell you information about the object that was hit. However, in many instances, you’ll just want to have an understanding of whether an object was hit or not, and not necessarily details about the object.

In this project, if an object is hit, it means the character is close to the floor, because the distance of the raycast can be measured. In this case, the jump button is enabled, and when the player is farther away from a platform and no longer “grounded” the jump button is disabled.

When performing raycasting, and many programming operations, you’ll need to “null check” certain values. Sometimes, a value may contain nothing. For instance, an integer could be 1, 2, 3, or 0, but even if it’s 0, that’s still a number. A value of null means the integer doesn’t have a value at all. In the case of a raycast hit, often times the raycast won’t hit anything at all, so if you’re checking for its value, you must perform a null check first.

// If the raycast is NOT null...
if (myRaycastHit != null)
{
// ...execute this code.
}

Link to the finished Code for your reference

10:35 Mask Break

10:45 English with Ms. Yopp

11:35 Skills USA Work Time

PSA Completion – Deadline to submit is Tuesday.

12:15 Lunch

12:45 Focus on Literacy

book covers

1:05 Mask Break

1:15 Production Time & Guided Support

PSA Submission

Skills USA work

2:05 Dismissal

GAWD Instructors:

Matt Cronin

Will Bohmann

Instragram Facebook Twitter

A little about GAWD:

Serving high school students interested in Gaming, Animation, and Web Development in North Western Vermont.

Students continue at:

University of Vermont Ringling School of Art and Design Northeastern University Rochester Institute of Technology Concordia University

Students find careers at:

Dealer.com Union Street Media Rovers North Prudential Investments DockYard
Navigate to top of page