Hi all,
I'm trying to set up a basic app framework for my Demoniak experiments, and ran into a couple of newbie questions. Just in case, you can download my (very small) test project here:
http://www.basilisksolutions.com/Simple.zip (it contains - and needs - the folders "common" and "Simple", to run it, extract both folders somewhere and load Simple/main.xml into Demoniak). Here are my questions:
1: What is the correct way to set a fixed physics timestep? For example, let's say I want the physics to run 100 times per second. This is what I tried (the comments on each line are taken directly from
http://www.ozone3d.net/demoniak3d/devguide-v1/api_hyp_lua_physics.php#SetTimingParams ):
HYP_Nx_Physics.SetTimingParams(
0.01, -- max_time_step - [REAL] - Maximum size of a substep - .
1, -- max_iter - [INTEGER] - Maximum number of iterations to divide a timestep into.
1, -- is_timestep_fixed - [INTEGER] - use(1) or not use(0) a fixed time step.
0.01 -- timestep_to_use - [REAL] - time step to use when is_timestep_fixed=1.
);I assume the timing values should be specified in seconds, or should it be in milliseconds (in which case I should change the 0.01 to 10)? In any case, I tried different values but it does not seem to have any effect, judging from the framerate and from the value returned by HYP_GetTimeStep().
2:
Related to the previous question, it looks as though the simulation always runs as fast as possible (i.e. the physics timestep may be 0.01s, I don't know, but in any case it's not running in sync with real time). With vsync disabled it runs at over 360fps. If I slow it down by enabling vsync, it runs at 60fps and you can see the cube drops a lot slower. So the question is, how can I synchronize the simulation time with real time? UPDATE: This is apparantly a known issue and will hopefully be improved in a future version.3: About nx_misc_data (used in the mesh xml tag):
-
What is the difference between actor_type DYNAMIC and KINEMATIC? UPDATE: Found the answer in the docs for HYP_Nx_Physics.SetActorKinematicState.- If I set density to some value (like 1) and mass to 0, will the actual mass be automatically calculated and set correctly?
4: I'm no expert on lighting, but the way I understand it is that ambient light means the level (and color) of light in the entire scene, and diffuse is the color of an object (theoretically, the color reflected by the object if white light is shining on it). Then what does the ambient value on an object material mean? And what does the diffuse value of a light node mean? In other words, what is the difference between ambient and diffuse in those cases, or how should I use them?
5: I have a light with shadow_emitter="TRUE" (high up in the sky like a sun), and a cube with shadow_caster="TRUE". Why don't I see the cube's shadow on my floor plane?
UPDATE: Seems like this works on some machines (thanks Shadow) and not on others (e.g. mine). Still not known why.6: The timer and mesh picking callbacks don't seem to work. Any thoughts?
7: I tried adding a cube with 1 segment on each side, by setting the segs attributes to 1, and that didn't work. However, if I set those attributes to 2, then I get the cube I want (with 1 segment to each side, as seen in wireframe mode). Is this a little bug?
8: Using HYP_Nx_Physics.GetActorCollisionPoint, does the length of the collision normal vector tell me the force of that contact point?
9: How does HYP_Nx_Physics.SetActorPairFlags work (i.e. how do I get notification about these events), and what are the default settings?
10:
Is it possible to change friction parameters of physics bodies? UPDATE: Yes, see docs for HYP_Material.Set[Static|Dynamic]Friction (thanks JeGX).11:
Pressing the escape key quits Demoniak3D. I've tried HYP_Input.DisableDefaultKeyboardFunctionalities() and HYP_Input.SetDefaultInputManagementState(0) but the escape key still exits the program. I'd like to be able to use the escape key for other things (without it quitting Demoniak3D), and also to be able to quit Demoniak3D programmatically from Lua (i.e. by calling HYP_Quit or something). Is this possible? UPDATE: It's on the wishlist.12:
I know I can see if a specific key is pressed using HYP_Input.IsKeyboardKeyPressed. I'd like to check if the user pressed *any* key (and which one). But the only way I can think of to do it now, is to check every key individually with HYP_Input.IsKeyboardKeyPressed, but this is probably not very efficient to do every frame. Is there another way to do this? UPDATE: It's on the wishlist.13: What is effectively the difference between primitives and their corresponding mesh types (for example HYP_Primitive.CreateSphere vs. HYP_Mesh.CreateSphere, etc)?
Any help would be greatly appreciated

Cheers