Sign in to follow this  
Digibo

Multiple objects & collision (DirectX)

Recommended Posts

Ok, as far as I understand it, to get multiple instances of a game object I just load it once and then render it with different transform matrices. But then how does collision between the objects work? For example I'd like to use D3DXIntersect (for unit selection in a simple strategy...) but I don't seem to understand which mesh should I pass it. Also how do I get different animation times/tracks for each game object with a single Animation Controller?

Share this post


Link to post
Share on other sites
Ok, each object has it's own Animation Controller, they are not tied to the mesh. The timing problem is solved.
But still the mesh intersect question..?

Share this post


Link to post
Share on other sites
If i understanding what your saying, what you need to do is transform the mesh and then check for intersection, and as far as instancing, youd end up with not only a transform, but a animation controller for each instance.

hope that helps
-Dan

Share this post


Link to post
Share on other sites
For the intersection - I think I got it, I have to apply the world matrix to the ray too(duh! :|). I'll have to rework the code so it takes each object's transform matrix, applies it to the ray and checks for collision with the mesh.

For the instancing - Yeah I figured out that each instance needs a separate Animation Controller, but now I'm trying to understand how is the controller "applied" to the mesh so you get the right thing to render. I've been ripping apart the MultiAnimation sample for hours and what I see is advancing the controller's time and then updating the frames starting from the root.. which is shared among all instances? I must be missing something because I see no link between the specific controller and the shared frame (the controller isn't passed anywhere). Hints?

Hope you manage to understand my far-from-perfect English :>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this