Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Gamasutra: The Art & Business of Making Gamesspacer
Games Demystified: Super Mario Galaxy
View All     RSS
March 8, 2021
arrowPress Releases
March 8, 2021
Games Press
View All     RSS

If you enjoy reading this site, you might also want to check out these UBM Tech sites:


Games Demystified: Super Mario Galaxy

March 27, 2008 Article Start Previous Page 4 of 4


The first 4 parameters are pretty easy to understand. We pass our player character and the 3 components of the surface normal to the function. The final 2 components are a bit trickier. The first of the two represents the axis we want to align along. For our implementation we want to pass a 2 for the Y-axis.

This means we want to align the character to this vector along his local up-down axis. The final parameter should be a floating-point number between 0 and 1, which represents the speed at which the character will snap to the vector.

In this case a 1 has been passed to make the alignment immediate. Smaller values will allow for interpolation between the previous alignment and the new alignment.

Next, we check to see if we are colliding with the planetoid or if we are above it because we jumped or are in orbit.

The EntityCollided() call requires two parameters which are the player character entity and the collision type mask we want to search for.

At the top of the program we created two types of collision masks. The first was a DYNAMIC type and the second was a STATIC type.

Obviously, the player character is dynamic and the planetoids are static because they don't move. So this call tells us if the player character of collision type DYNAMIC has collided with some other object (any other object) of type STATIC.

If we are colliding then we set our jumpTimer to the current time and we zero out our velocity. In the updateControl() code we allow the character 250 milliseconds of boost along the surface normal for jumping.

Once those 250 milliseconds are exceeded (or the player lets go of the jump button) the jump force will no longer be applied and the character must touch base to jump again. Finally back in the updatePhysics() call if we aren't colliding then we subtract the current surface normal from our velocity and translate our character back toward the planetoid.

The final component of the updatePhysics() function checks the planetoidClass list to see if we're actually closer to some other planetoid. If we are then we switch planetoids so the next time updatePhysics() is called we'll check with this new planetoid to calculate gravity.


In closing, it's obvious that there is much more to Super Mario Galaxy than the cool gravity mechanic the developers employed. Although the included source code covers things like camera tethering and control, it only scratches the surface of what went into making Super Mario Galaxy a polished gem and an achievement in gameplay.

Of course, the one feature that wasn't included in other Mario games was the gravity effect and that's what distinguished Galaxy from the rest of the series and indeed the rest of the industry this past holiday season.

Hopefully, this segment of Games Demystified offered a useful peek inside the underpinnings of game development. Until next time... Waahoo!

Article Start Previous Page 4 of 4

Related Jobs

Crate Entertainment
Crate Entertainment — Boston (Work Remotely), Massachusetts, United States

Senior Gameplay / Engine Programmer
Bitwise Alchemy
Bitwise Alchemy — Austin, Remote, Remote

Senior Software Engineer (Remote)
Sucker Punch Productions
Sucker Punch Productions — Bellevue, Washington, United States

Audio Programmer
Airship Syndicate
Airship Syndicate — Austin, Texas, United States

Senior Gameplay Programmer

Loading Comments

loader image