I have searched literally everywhere now, and cannot find a direct answer as to which would be the best way to achieve the “Rolling Log” effect.
The idea is to have a spherical (or what seems to be) world, and have it pretty much roll under the players feet. If you have ever played Animal Crossing, or DeathSpank, you know what I am talking about.
Example:
It needs to be like that, but not really as much in depth… This is just a simple dodge game, where the enemies are always coming toward you, and you aren’t moving forward at all. You move only along the X Axis. So, all I really require is for my terrain to look spherical, and the enemies to spawn on the terrain, but over the sphere, out of the players vision.
I have narrowed it down to about 2 choices now. One is to create an actual spherical world, with all of the assets created relative to that. This would mean that I have to program the physics behind that, though, and I am not the best physicist in the world. xP
The next option is to make some special kind of vertex shader, but I have no idea where to begin with shader scripting, let alone vertex shaders.
My question is, would you do the spherical world theory, or the vertex shader, and where would you begin?
Not to nitpick, but Deathspank’s world looks more cylindrical than spherical. At any rate I can’t imagine being able to achieve the same look with just a shader, but I could be wrong.
Though I don’t think the physics needed here are at all complicated. You basically need two ingredients: First, simulate gravity by applying a force to each object that points towards the center of the sphere. And then rotate each object at each frame so that it’s oriented along the surface normal of the sphere.
I have decided to go with a cylindrical world that rotates. My problem now is creating some kind of way for the enemies to “stick” to the cylinder, and move the enemies transform, and giving them a new random position along the x Axis once they have passed by the player. I was thinking about some sort of grid system, but I haven’t messed with any kind of grids at all yet… Any good links on grids? Preferably one around a cylindrical object. xP
I actually achieved this quite simply, by just creating a huge cylinder. I kept the old script containing the enemies’ RandomPosition() function, and just childed the objects to the cylinder on instantiation. I set it to instantiate their starting Y position relative to the height of the cylinder, and everything works smoothly.
So, if the height of the cylinder is 100, and the height of the enemy is 1, then the starting Y position of my enemy would be 51. Then, the RandomPosition() function spawns the enemies at a random position along the Z axis, between 10, and 15. Which is over the cylinder, and the player cannot see it yet. The cylinder spins the enemy, and once the enemy’s Z position is <= -30, I call RandomPosition() again. This can all be achieved as long as you keep the size of the cylinder in mind. I know that if the width of the cylinder is 100, so that means the objects can -be attached to it anywhere along the Z axis from -50, to 50.
So, this brings me to the final question before completion of the game… Is there any way to “wrap” Unity basic water around a cylinder? I’ve tried just applying the texture, shader, etc to the cylinder, but it definitely doesn’t look like water lol xP
No need for a grid system! Thanks for the help guys!