• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

How To Make Spinning Terrain?

B

BuddyRoach

Guest
This one is a little hard to describe which is why I am bothering making a post about it in the first place. I am wanting to make a game with a specific mechanic. It will be a side scrolling platformer, first off. But I want the terrain to be rounded and to spin as the player moves along it. To get what I am talking about, look at No Mario's Sky see video:
or like in Wario Ware: Twisted see video:
I dont even know where to begin.
 
R

renex

Guest
I did this before using a simple straight line generator and a spherifying vertex shader.

What you need to do is specify a point on the screen that is the center, and then simply transform x coordinate into an angle around that.
 

FrostyCat

Redemption Seeker
Begin by reading up on the polar coordinate system and how to use lengthdir_x() and lengthdir_y(). Instead of operating on x and y like standard platformers and side-scrollers, you will be operating on the radius from the centre (r) and the angle (theta). The only time that you operate in Cartesian coordinates is when drawing, and the conversion from polar coordinates can be done with lengthdir_x() and lengthdir_y().
 
Z

zircher

Guest
I love that there are several ways to approach this. I'll pitch mine... Go with the built in physics system, but set gravity = 0. Then each step apply a small impulse towards the center of your level to simulate gravity as a point and not a direction. When your character jumps, just apply a larger impulse in the opposite direction. As the world rotates along, apply a tangent vector to move left or right. It seems doable and you would have the benefit of using the physics system to handle your movement and collisions with solids.
 

Roa

Member
I was about to say, use a shader or save the graphics to a surface, then use the surface as a texture for a d3d_triangle fan
 

FrostyCat

Redemption Seeker
I love that there are several ways to approach this. I'll pitch mine... Go with the built in physics system, but set gravity = 0. Then each step apply a small impulse towards the center of your level to simulate gravity as a point and not a direction. When your character jumps, just apply a larger impulse in the opposite direction. As the world rotates along, apply a tangent vector to move left or right. It seems doable and you would have the benefit of using the physics system to handle your movement and collisions with solids.
For better consistency within the simulation, you should actually be applying a force consistently (centripetal force), not pumping impulses. The exact force required can be given by F_c = m*v*v/R, where m is the mass, v is the velocity perpendicular to the radius, and R is the radius.
 
Top