Adding rotations to the collision transform table argument
CoderLFS opened this issue · 3 comments
Library allow us to rotate a model, but when we do so, we can't set the rotation to the collision set of vertices.
could we add rotations to the collision transform table like so: collisions.sphereIntersection(verts, {scale={}, translation={}, rotation={})
?
Unfortunately multiplying each point in a model with a rotation matrix whenever the model rotates can be extremely computationally expensive, and would result in the game's framerate dropping.
Rotating colliders are not necessary for 3D games even as complex as Super Mario 64, so I don't think they're necessary. You can still manually approximate rotating colliders yourself if you want to, but I don't plan on adding them into g3d.
Thank you for the anwser,
The actual problem is that if i rotate an object once, there's a mismatch between the displayed model and the collisions.sphereIntersection calculation which really look like a bug.
Could it be possible to get a model:updateState()
that you would use once and that would make the sphereIntersection use the new rotated list of point instead of the base model before rotation?
Is there any roadmap about what you plan on adding into g3d?
I consider g3d to be roughly "done", I don't plan on adding new features.
I know this isn't the answer you want to hear, but I designed g3d with extensibility in mind. That's part of the reason why it doesn't have a ton of features or a strong opinion about how you structure your game. Implementing that feature yourself would not be very difficult. The basic idea is that you would want to keep a second list of vertices for each model that you use in collisions, and you multiply each vertex by the transformation matrix whenever you call your proposed model:updateState()
function.
Good luck!