Repositioning objects to stay in the same position relative to each other when rotated.

I have a grid of cubes, and currently when the rotation of a cube is requested it adds it with the rotation of it's grid. While this does keep the rotation of all objects in the grid synced, it does not reposition them to upkeep the illusion of them being one solid object. I'd imagine the solution would be as simple as also modifying the position of each cube based on the grid rotation, but I need some help figuring out what mathematical calculation would be needed.
No description
7 Replies
JavaBot
JavaBotā€¢4mo ago
āŒ› This post has been reserved for your question.
Hey @š“pothicon! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
š“pothicon
š“pothiconOPā€¢4mo ago
so basically i need help with figuring out what to replace "Something that factors in the rotation value" with math would fix this
Vector3f rotatedPos = new Vector3f((pos.x+gridPos.x)+"Something that factors in the rotational value", (pos.y+gridPos.y)+"Something that factors in the rotational value", (pos.z+gridPos.z)+"Something that factors in the rotational value");
Vector3f rotatedPos = new Vector3f((pos.x+gridPos.x)+"Something that factors in the rotational value", (pos.y+gridPos.y)+"Something that factors in the rotational value", (pos.z+gridPos.z)+"Something that factors in the rotational value");
JavaBot
JavaBotā€¢4mo ago
šŸ’¤ Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
š“pothicon
š“pothiconOPā€¢4mo ago
Reopen
JavaBot
JavaBotā€¢4mo ago
šŸ’¤ Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
š“pothicon
š“pothiconOPā€¢4mo ago
Reopen or maybe its more to do with this part?
modelMatrix.translationRotateScaleMulAffine(position, rotation, new Vector3f(scale, scale, scale), gridMatrix);
modelMatrix.translationRotateScaleMulAffine(position, rotation, new Vector3f(scale, scale, scale), gridMatrix);
JavaBot
JavaBotā€¢4mo ago
šŸ’¤ Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server