Complex shapes and setting their position.

Started by
13 comments, last by Gtadam 3 months, 3 weeks ago

Hmm, okay, but that means i have to attach a translation matrix to each intersect method or something.

I think i don't need to refresh the world space coordiantes for static entities but dynamic entities need them all the time.

Advertisement

Gtadam said:
Hmm, okay, but that means i have to attach a translation matrix to each intersect method or something.

Yeah, but often the cost of transforming all vertices can be still avoided.
E.g. if you do a ray trace or closest point calculation, you can transform the ray / query point to the local space of the object, working with untransformed local vertices, then transforming the result back to world space if needed.
So you may need only one or two matrix multiplies instead one per vertex.

Another option is to transform vertices but cache the results.
E.g. we have huge open world not fitting into memory, but likely we can still ‘uncompress’ a local area around the player to worldspace, cache and reuse the data until some chunks stream out or in.

Gtadam said:
I think i don't need to refresh the world space coordiantes for static entities but dynamic entities need them all the time.

Yes. Basically you only need to update world space coordinates if:
Some object has changed it's transform. (likely dynamic objects)
Some object comes into existence because the player has moved close enough. (likely distant static objects from open world)

The distinction is not necessarily static vs. dynamic objects, and dynamic objects are often at rest and do not move over several frames.

If your levels are small enough so they fit in memory without problem, you could just transform all your instances to worldspace to keep it simple, and you can still utilize the content creation advantage from working with instances of modular models regardless.

Open world not only requires to manage streaming and memory, but we also need some solution for the ‘large coordinates’ problem to avoid precision issues. Such solution is usually to keep the coordinate origin close to the player (increased complexity), or using double precision (increased performance and memory cost).

So game dev becomes a lot harder with open worlds, just to make the games bigger and eventually more boring. :D

Thanks again JoeJ for the really good answers xD.
Will ponder it for a while :D

protected boolean intersectSAT(final Matrix wsMatrix, final Shape that, final Matrix wsMatrixThat){}

Is it possible just to attach one matrix?
I'm thinking is it sufficient to just transform the world space matrix of shape s2 into local space of s1?
I still don't see how you can only need one matrix as both objects can be rotated…

This topic is closed to new replies.

Advertisement