CSS 451: Programming Assignment #1

Fun with Using and Showing Math

 

Due Time: Refer to the course web-site

 

Objective

In this programming assignment we verify the math we learned in class by maneuvering simple object in 3D space.

 

Approach

Please refer to my solution. Our world must have at least two views with three objects, a hero object (mine is a tiger), a lead object (mine is a space craft) and a floor. Under user control, the lead object leads the hero object around in our 3d world. Here is how:

1.      Object Distance (D): When the hero object is within D distance from the lead object, it moves at a constant velocity (constant speed and direction). The moment when this distance is greater than D, you will:

a.      Speed and velocity of hero: Compute the location of the lead object (P) and move the hero object towards P at Object Speed (S). After the hero object start moving at its new velocity, the position of the lead object may change, but as long as the distance D constraint is not violated, the hero object should continue traveling with the newly computed velocity.

b.      Orientation of Hero: Compute the new orientation of the hero object according to: the hero’s head will point towards the lead (forward) and up direction of the hero will be the same as the lead. When forward direction is the same as the lead’s up direction, hero’s up direction is not well defined, and you are free to choose an arbitrary up direction for the hero.

2.      Object Speed (S): This speed is under user control, it specifies the magnitude of velocity for both the hero object and the lead object. Notice that the hero object will only refer to S when the distance D constraint is violated. Your speed will be in units/seconds.

3.      Lead Object Velocity: The lead object’s traveling direction is completely under the user control. The speed of the lead object is S. Note: 1,2, and 3 says, if user changes S, the Lead Object will react immediately, but as long as D-constraint is not violated, the hero object’s velocity will not change.

4.      Projected Hero Velocity: At any time, the user can choose to project the hero object velocity onto the floor along the floor object’s normal direction.

5.      Hero Colliding the Floor: When enabled, you must detect the collision between the hero object and the floor object. When collision occurred, the hero object will bounce off the floor. The velocity of the hero object will be reflected across the normal direction of the floor. Note: If the lead object has traveled across the floor object and the D-constraint violated, the hero object will appear to be bouncing on the floor object.

 

With the above specification, the user must have controls over:

1.      Object Distance (D): the range in my implementation is 0-20 units.

2.      Object Speed (S): the range in my implementation is 0-10 units/second.

3.      At all time, the user can change the transformation of any of the objects.

4.      On/off switches on: Hero Object Motion, Lead Object Motion, Hero Velocity Projection, Floor Collision Detection, Axis Frame Indicator.

 

Your lead object must be defined such that it has a clear difference between front and back. The front of the lead object must always face towards the motion direction. All objects must have their own Axis Frame Indicator. The axis frame is the x, y, and z axis when an object was first defined. As an object travels/rotates and/or gets manipulated, the axis frame of the object should follow the object. For example, no matter how my tiger gets rotated and/or manipulated, the head is always pointing towards the negative z-axis, and up is always the positive y-axis. When user specifies rotation and/or manipulates an object, this object axis frame must be used as the reference axis. In my implementation, I kept the drawing of axis frame as part of the show pivot functionality from mp1 in my SceneNode class.

 

Your world should have a bound, and when the lead object attempts to move out of your world’s bound, you should force the object speed to zero. You must draw the bound for your user (and user must be able to switch this bound on/off). Please leave the camera manipulation functionality, I need to have the default mouse-camera control to figure out what you are doing. Lastly, you must support a reset button to reset your world back to initial condition.

 

Credit Distribution

Here is how the credits are distributed in this assignment:

 

1.   

Lead Object:                                    

20%

 

a.    Position

b.    Velocity Direction/Magnitude

c.    Motion on/off

 

No Axis Frame Indicator          

5%

10%

5%

 

-10%

2.                  

 

Hero Object:

30%

a.    Distance constraint

b.    Orientation                          

c.    Velocity (direction/speed)

d.    Motion on/off 

 

No Axis Frame Indicator

10%

15%

5%

5%

 

-10%

3.                  

Floor Object:

35%

a.    Hero Velocity Projection     

b.    Hero Object Collision        

c.    Velocity Projection on/off     

d.    Collision Detection on/off     

 

Floor cannot be transformed

No Axis Frame Indicator

 

15%

20%

2%

2%

 

-30%

-15%

4.                  

Others:

10%

a.    Large Central Axis Frame              

b.    Reset Button                       

c.    Bound drawing/stopping               

 

No mouse-camera control  

Only one camera view              

 

5%

5%

5%

 

-50%

-50%

5.                  

Misc:

5%

a.    style/correct submission etc.

 

 

Extra Credit:                                                                                                          

 

1 pt: Allows the dragging of the hero object by the lead object when the hero is not in motion. When the hero object is not in motion and D-constraint is violated the hero object will be dragged (linearly) towards the lead object such that the distance between them is exactly D.

 

2 pt: Damped stopping of the hero object. If the lead object stops while the hero object is still in motion, hero object will continue its current velocity until the D constrain is violated. At such time, the hero object’s velocity will change into reverse direction, and speed will decrease (and not go to zero) this bouncing of hero object around the lead object will continue until eventually the hero objects’ speed reaches zero.

 

3 pt: Your user have the option to switch on world gravity that will pull the hero object in the negative Y direction at (9.8*40) units/second.second. Notice that your hero object will only obey to gravity when it is in motion, and gravity must obey the above distant (D) constraint.

 

 

This programming assignment will count 15% towards your final grade for this class.

 

 

WARNING: The math involve can be very tricky!! Please Please please start ASAP and bring questions to classes!