R
Rukola
Guest
Hello new forum!
I'm using JuJu's 3d planet model for rotating a 3d cube. This works quite nicely but I'm trying to have a character walk this cube and her being able to walk over the edge of the cube on to the next plane of the cube!
To do so, I use quaternions | quaternions. I heard they're not necessary but it seems like an elegant solution.
What I can't get right however, is see on which exact plane the character is and which angle that plane is turned to. So before I know it, the character is moving into the cube or is facing away from the camera.
Last but not least, I want to do this with an AI walking the cube as well.
what to do?
This is the code for walking on each plane of the cube but when rotating this goes very wrong:
old:
I'm using JuJu's 3d planet model for rotating a 3d cube. This works quite nicely but I'm trying to have a character walk this cube and her being able to walk over the edge of the cube on to the next plane of the cube!
To do so, I use quaternions | quaternions. I heard they're not necessary but it seems like an elegant solution.
What I can't get right however, is see on which exact plane the character is and which angle that plane is turned to. So before I know it, the character is moving into the cube or is facing away from the camera.
Last but not least, I want to do this with an AI walking the cube as well.
what to do?
This is the code for walking on each plane of the cube but when rotating this goes very wrong:
Code:
switch(plane)
{
case 0: x+=hsp; y+=vsp; break; //top
case 1: y+=hsp; z-=vsp; break; //right
case 2: x+=hsp; y+=vsp; break; //bottom
case 3: y+=hsp; z-=vsp; break; //left
case 4: z+=hsp; x+=vsp; break; //front
case 5: z+=hsp; x-=vsp; break; //back
}
It's set up so that the camera doesn't move but Jujus code rotates every object in my room with this:
Then my character changes variable side whenever she walks across a border to 1 of the 6 sides:
This totally doesn't work however because as soon as you move right, down and then left the character warps to a wrong side. And this already happens without the cube rotated..
help!
tldr: I'm trying to understand how 3d rotations work in a degree so that I can combine and manipulate them beyond the usual scope.
Code:
d3d_transform_add_rotation_axis( camera_quat_a, camera_quat_b, camera_quat_c, camera_quat_d );
Code:
switch(side)
{
//0 = top
case 1: d3d_transform_add_rotation_axis(0, 1, 0, 090); break; // right
case 2: d3d_transform_add_rotation_axis(0, 1, 0, 180); break; // bottom
case 3: d3d_transform_add_rotation_axis(0, 1, 0, -90); break; // left
case 4: d3d_transform_add_rotation_axis(1, 0, 0, -90); break; // front
case 5: d3d_transform_add_rotation_axis(1, 0, 0, 090); break; // back
}
help!
tldr: I'm trying to understand how 3d rotations work in a degree so that I can combine and manipulate them beyond the usual scope.
Last edited by a moderator: