PDA

View Full Version : Gravity and Collision Detection


Lily_Haze
01-23-2009, 09:53 AM
Hey there everyone!

I'm a high school student enrolled in the school's first ever Game Programming course. Currently the many students in my class have mostly free reign to just experiment with the program and make whatever they can. We are free to consult one another and any other info we can find to make our programs.

I, as is par for the course for me, have decided to take things too far, far past the point of my understanding.

I want to make a program with both collision detection (something Alice 2.0 is clearly limited in) -and- universal gravity.

Truly, the collision detection would be enough for me, I can proceed with many of my unfinished projects with just that. The gravity is just me wanting to create something dramatic.

Others go for the violent gaming approach immediatly, and of course my first thought is to try and make a physics engine. XD

Is there any advice on how to do either of these things?

tl;dr
I'm looking for help on Collision Detection and a Gravity system.

Niteshifter
01-23-2009, 11:56 PM
There are quite a few different approaches towards the collision detection. However, Alice is only limited to a select number of them because of it's "lacking abilities". I am trying to do two different methods of doing it, but I'm not finished with them yet. They both use remotely the same function which is "if the object is touching another object, then return true". The only hard part is finding out that distance. My first method of trying this was to find out an algorithm to get the distance from the center point of the object (which is usually the center of the object on the bottom) using the height, width, and depth functions, however it wasn't working properly. My second method was to find the bounding box using manipulations of the vectored positions, but this didn't work either because of some other things that Alice is unable to do.

Collision detection can be somewhat easy to do, but I'm aiming to have the least amount of functions, events, etc as possible.

As for the gravity side of things, there are 3 parts, and they are: falling, rolling, and friction. Falling is pretty obvious, Rolling is if the object ends up rolling across the ground, or not depending on it's shape, and friction which is if an object would be how fast an object would go through wind, or if the object is sliding against a surface (whether it be flat, or bumpy).

As you can see, attempting to do this can be very hard, tedious, and long, and you may want to know a second (or even third) coding language to go by in case things get more confusing. (I, personally go by both Lua, and C, and sometimes even java if things get tough during Alice scripting because of how much stuff is missing in Alice.)

Lily_Haze
01-26-2009, 09:27 AM
The rolling and friction I'll work on second, simple falling is my main concern right now.

I know a bit of C++ and C#, but, and forgive my ignorance here, how do I implement that in my alice world?

Niteshifter
01-26-2009, 06:29 PM
You would literally just translate it yourself.