Magnetaphysics


Nathaniel Garcia


CPE 471 Sprint 2008


Zoe Wood


  


Description:


            Magnetaphysics is a game that simulates the physics in magnet interaction. The user controls a small orange (positive) magnetic ball (Mag-Ball) using the camera and movement keys to interact with a larger floating orange (positive) ball and a floating blue (negative ball). By changing the polarity of the Mag-Ball between orange positive and blue negative, the user can interact with the attraction and repulsion forces of the larger balls.


Additionally, the user is able to change the gravity towards one of the 6 faces of the cubic world. The green face indicates the floor with respect to the gravity direction. A large torus is placed as a goal for the user to try to shoot the ball through by manipulating the camera and the polarity of the Mag-Ball. The Torus does not have collision detection but the large spheres do.


User Controls:

magnetaphysics.bmp.gif

-Movement controls are with respect to the camera

‘W’ - Forward

‘A’ - Left

‘S’ - Backward

‘D’ - Right

 

-Forces manipulatio n

Space - Switch Polarity of Mag-Ball from positive-to-negative and negative-to-positive

‘1' - Set gravity pull against the BOTTOM face (default)

‘2' - Set gravity pull against the TOP face

‘3' - Set gravity pull against the LEFT face

‘4' - Set gravity pull against the RIGHT face

‘5' - Set gravity pull against the BACK face

‘6' - Set gravity pull against the FRONT face


-Miscellenous

‘N’- Toggle on / off (default) display of normal vectors

‘T’ - Toggle on / off (default) display of blue floor with orange tile tracing

‘0' - Set gravity pull to 0 (broken)


Development Limitations and Issues


            True magnetic fields are not used to calculate magnetic force vectors. When the Mag-Ball comes within 3.0 of the center of a large sphere, a force greater than gravity is applied directly toward or against the large sphere depending on the polarity. Collision detection is implemented on walls and spheres. Collision detection for other shapes proved more complicated and requires more development time.


            Velocity perpendicular to the gravity normal is not maintained while the ball is flying through space but instead slows as though a constant force is resisting it. This is similar to a ball being thrown underwater.


            If force from the user is constantly applied against a wall, the combined normals will eventually become perpendicular to gravity causing the ball to roll up the wall until gravity brings it back down.


            The torus goal does not detect collisions. It was added late in development to provide the user with a goal other than experimenting with the physics.


            Lesser quality graphics cards or a larger view window will cause a decrease in game speed/performance as movement calculations and collision detections occur in the Idle() function. Constants were hard-coded and tuned to lab computers at the time of development.


            Further development time would yield collision detection and magnetic properties for cylinders and other shapes as well as vertical expansion of the world to include other large magnetic shapes that move and bounce around with the goal for the user being to climb to the top.


References


A good tutorial on 3-dimensional collision detection.

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=30


Explanation of vector manipulation

http://knol.google.com/k/koen-samyn/dot-product-cross-product-in-3d/2lijysgth48w1/10#