Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question regarding 3D object rotation #39

Open
h3xstream opened this issue Jun 15, 2023 · 0 comments
Open

Question regarding 3D object rotation #39

h3xstream opened this issue Jun 15, 2023 · 0 comments

Comments

@h3xstream
Copy link

h3xstream commented Jun 15, 2023

It is possible to do multiple transformations in an object "block" (begin - end).

GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewRotate(0,0,a*4);
GRRLIB_ObjectViewTrans(0,1.0,0);
GRRLIB_ObjectViewRotate(0,0,a*2);
GRRLIB_ObjectViewTrans(0,0.5,0);
GRRLIB_ObjectViewRotate(0,0,a*2);
GRRLIB_ObjectViewEnd();

GRRLIB_DrawCube(0.4f,0.5,0x0000FFFF);

It seems that rotation is always relative to 0,0,0 position.

How can I make my object rotate relatively to a 0,1,0 ?
I need to rotate object like a planet orbit around the sun, not on itself.

//The following code won't work
GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewTrans(0,1.0,0);
GRRLIB_ObjectViewTrans(0,0.5,0);
GRRLIB_ObjectViewRotate(0,0,a*2);
GRRLIB_ObjectViewEnd();

GRRLIB_DrawCube(0.4f,0.5,0x0000FFFF);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant