Loading...
You are not logged-in Login/Register





  • Posts   Search Threads
  • setasohjiroNovember 6, 2008 8:09 AM PST   
    Associating RigidBody with graphics file

    HI! I am trying to create my world loader which will operate in this manner.

    When exporting from the art pipeline to keep things simple I was going to keep the name of the mesh and rigidbody the same ( except for the file extensions ) so what i would end up with would be

    box1.graphics

    box1.hkx

    the plan is to have my loader loop through loaded physicss systems and load phantoms rigidbodies etc but the most important thing is getting the name of the rigidbody so that it can be used to load the name of it's .graphics file.

    i noted that hkpPhysicsData has a findRigidBodyByName() method but i can't see a source file for it and on closer inspection it doesn't look like hkpRigidBody has a name atribute, and in addition to that on closer inspection i noticed i can't name rigidbodies in my modelling program.

    I was just wondering what would be the recommended method for loading a rigidbody and associating it with a graphics file.

    Thanks



    sean.thurstonNovember 6, 2008 1:43 PM PST
    Rate
     
    Re: Associating RigidBody with graphics file

    Hi setasohjiro,

    Are you going to have an hkx file for each rigid body or are you going to have your world (streamable world chunks) as hkx files? There is the mantra on this forum that you should try to limit the number of objects in the broadphase, so all static geometry should be wrapped up into a single mesh. box1 is most likely dynamic though so while it should still be part of a larger packfile, you should be able to do this.

    In Max, and in Maya too, you can set the name of individual objects. Which modeller are you using? When you click on an object you can give it a specific name. There is a little name field on the right panel. That name is picked up by the exporter and all hkpWorldbjects have an m_name field (hkpRigidBody inherits from hkpWorldObject). If you look at the object using the ViewXML filter you can see the name field will be set to the name that you specificed for the object. Then you should be able to grab the rigid body from the packfile by its name. You would just need to make sure that all the names matched.

    This is one way to match up graphics and physics objects and there are probably others.

    Thanks,
    Sean

     



    Developer Support Engineer
    Havok
    www.havok.com

    setasohjiroNovember 12, 2008 7:19 AM PST
    Rate
     
    Re: Associating RigidBody with graphics file

    Thanks for your response it was the solution to my problem. I now face a slightly more complicated problem which is trying to get the hkpRigidBody to setUserData to my custom class which holds the rigidbody and graphics node.

    What i am trying to do is something along these lines.

    rigidbody->setUserData( customClass );

    so that when running through the list of active simulation islands i can get the entities which need updating and do something like:

    rigidbody->getUserData()->updatePostion();

    rigidbody->getUserData()->updateOrientation();

    I thought it might have something to do with registering classes? i'm not sure...

    (some example code would be much appreciated)

     



    sean.thurstonNovember 12, 2008 6:38 PM PST
    Rate
     
    Re: Associating RigidBody with graphics file

    Hi setasohjiro,

    You can really set the the userData with a custom class. It is an hkULong and you are trying to pass in a pointer. If you want to use the user data, tehn you could use it to sotre an index into an array of your custom classes. Then you could just grab that value and access the array. Or you could have it store a hash value that you use to access a hash table which might be better if you are adding and removing bodies.You could probably use properties to do this as well. User data might be used in other places by certain constraints.

    Since you are probably going to be rendering all your graphics objects in a single pass, you could just grab the transform at that time to change the graphics object before it gets rendered. This is how I would imagine most people do it.

    These are a couple of ways to do it. There are most likely others as well.

    Thanks,
    Sean



    Developer Support Engineer
    Havok
    www.havok.com

    setasohjiroNovember 17, 2008 12:40 AM PST
    Rate
     
    Re: Associating RigidBody with graphics file

    Thanks again for your help and advice as always much appreciated. :)



Forum jump:  

Intel Software Network Forums Statistics

16,364 users have contributed to 46,333 threads and 163,905 posts to date.

In the past 24 hours, we have 29 new thread(s) 154 new posts(s), and 85 new user(s).

In the past 3 days, the most popular thread for everyone has been Formula for the intersection of straight lines The most posts were made to Take a look at John Burkhard&# The post with the most views is Intel PCM - How can I watch monitoring results of multi core of AWS CC1?

Please welcome our newest member mfahad


For more complete information about compiler optimizations, see our Optimization Notice.