one stop for all game coders..
| Rigid Body creation - D11.5 |
|
|
| Written by CR Team | |||||||||||
| Saturday, 18 July 2009 07:45 | |||||||||||
|
The previous article talked about creation of rigid body from models/mesh. This process can sometimes take time due to the complexity of the mesh. Also the createRigidBody( ) method would not allow one to create dynamic concave rigid bodies. Before going into the details we need to understand what a proxy template is… A proxy template allows a user to create pre-calculated proxy/hull for a given model and then use it. This has several advantages:
There are basically 2 workflows that can be followed with the new set of methods provided.
Out of the 2 workflows, we recommend using the authoring one to avoid the overhead of creation of proxy templates each time. The blocks in blue are the newly added methods for creating proxy temlates in Director 11.5. For more info on each of the methods refer the help doc. In workflow-1 ,steps from createproxyTemplate() to saveW3d() , can be performed once for creating the required proxy templates for all the models in the 3d world. During runtime, only loadProxyTemplate() and createRigidBodyFromProxy() methods need to be used as the proxy templates are already saved in the specified 3d member. Use of message window or running through all the models with a loop and creating the required proxy templates and save them into a 3d member using saveWorld() or saveW3d() methods would be ideal. Some tips while using these methods:
ModelResourceRef - model resource cannot be Director primitive(like #box,#sphere etc..) except #mesh type. All other w3d modelresource are allowed. proxyTemplateSymbol - decomposition parameter list - #depth ( number of cross sectional planes running through a model , lesser the faster, range:0-10 , ideal:4-8) ,
3dmember - a 3d world , ideally would be nice to have one 3d world dedicated to proxy templates to avoid all the confusion. proxyTemplate - this is the template returned by createproxyTemlate() method. proxyname - a unique name for the proxy template, use conventions like cdx_name, ccv_name,cvx_name for #convexdecomposed, #concave and #convex proxy templates respectively. One can visualize the proxy/hull created using the rb.properties property of the rigid body. For a more detailed explaination on using this in you code have a look at the Proxy Template Howto tutorial !
|
|||||||||||