PSE Game Physics - Summer 12 - FAQs
Questions to Worksheet 1
- Q: How can I get the number of seconds elapsed during the last frame?
- A: This value is stored in 'frame_elapsed_time'
- Q: The integration method is called by no method.
- A: Calling this method at an appropriate point is one of your tasks to get familiar with the engine.
- Q: How can I change the position of an iPhysicsObject
- A: You can use the translate() method of the object.
- Q: With activated desktop effects, the window content isn't updated as fast as the displayed FPS and by far less than 50 FPS. What's the problem?
- A: There seems to be an window-title-update problem with the newest Ubuntu version when the window title is set to a new string frequently during one second.
To solve this problem, avoid updating the window title. Replace the corresponding lines in file 'main.cpp' with this code to render the desired information just on-screen:
* update window title */
title_text << " Scene: '" << cScenes->scene_description << "'";
title_text << " FPS: '" << engine.time.fps << "'";
engine.text.printfxy((float)20, (float)engine.window.height-20, title_text.str().c_str());
Questions to Worksheet 2
- Q: How can I get the Plane Factory data?
- A: You have to cast the generic objectFactory pointer to the primitive specific one.
cObjectFactorySphere &sphereFactory = *((cObjectFactorySphere*)sphere_object.objectFactory->original_factory_ptr);
Since objectFactory is of type iBase, you can also use the following static_cast:
cObjectFactorySphere &sphere_factory = static_cast<cObjectFactorySphere &>(sphere_object.objectFactory.getClass());
Questions to Worksheet 3
- Q: Quaternions & left-/right handed coordinate system
- A: Have a look at this website: http://en.wikipedia.org/wiki/Cartesian_coordinate_system#Orientation_and_handedness