d3d_transform_set_scaling(1,1,1) //Set the translation to the scaling (_set_ removes all previous transformations) d3d_transform_add_rotation_z(radtodeg(rot)) //rot is in radians, but the function takes degrees d3d_transform_add_translation(x,y,z) //Add the translation after rotation d3d_draw_ellipsoid(-0,-0,-0,32,32,32,texture,1,1,16) //Draw an ellipsoid with radius 1 at (0,0,0) d3d_transform_set_identity()Now, this works for rotating but it rotates as if the object were a sprite and its origin of rotation or anchor point or whatever you would call it is not at 16,16 but instead 0,0. Help.
Off center rotation
#1
Posted 11 February 2012 - 04:36 PM
#2
Posted 11 February 2012 - 05:42 PM
d3d_transform_add_translation(x,y,z+16) d3d_draw_ellipsoid(-16,-16,-16,16,16,16,texture,1,1,16)
#3
Posted 11 February 2012 - 05:55 PM
You need to draw the ellipsoid centered at (0,0,0), which will be the center of rotation. Right now you're drawing it at (16,16,16). Also, the d3d_transform_set_scaling is there for a reason:
d3d_transform_set_scaling(32,32,32) //Set the transformation to the scaling (_set_ removes all previous transformations) d3d_transform_add_rotation_z(radtodeg(rot)) //rot is in radians, but the function takes degrees d3d_transform_add_translation(x,y,z) //Add the translation after rotation d3d_draw_ellipsoid(-1,-1,-1,1,1,1,texture,1,1,16) //Draw an ellipsoid with radius 1 at (0,0,0) d3d_transform_set_identity()Please don't be afraid to ask, I'd rather not run around looking for new topics with the same question
Edited by TheSnidr, 11 February 2012 - 05:57 PM.
#4
Posted 11 February 2012 - 06:10 PM
Sorry! I edited my post because I didnt want to make a new post because it would be redundant to have the same information in the same topic twice.Oh, you made a new topic? If you had answered my question in the old one I could've answered you there.
You need to draw the ellipsoid centered at (0,0,0), which will be the center of rotation. Right now you're drawing it at (16,16,16). Also, the d3d_transform_set_scaling is there for a reason:d3d_transform_set_scaling(32,32,32) //Set the transformation to the scaling (_set_ removes all previous transformations) d3d_transform_add_rotation_z(radtodeg(rot)) //rot is in radians, but the function takes degrees d3d_transform_add_translation(x,y,z) //Add the translation after rotation d3d_draw_ellipsoid(-1,-1,-1,1,1,1,texture,1,1,16) //Draw an ellipsoid with radius 1 at (0,0,0) d3d_transform_set_identity()Please don't be afraid to ask, I'd rather not run around looking for new topics with the same question
#5
Posted 11 February 2012 - 06:13 PM
And also, SORRY FOR THE DOUBLE POST but i dont want to just edit it, Now, its too big. And also when i roll to the left it stays rolling right instead of rolling left...Sorry! I edited my post because I didnt want to make a new post because it would be redundant to have the same information in the same topic twice.
Oh, you made a new topic? If you had answered my question in the old one I could've answered you there.
You need to draw the ellipsoid centered at (0,0,0), which will be the center of rotation. Right now you're drawing it at (16,16,16). Also, the d3d_transform_set_scaling is there for a reason:d3d_transform_set_scaling(32,32,32) //Set the transformation to the scaling (_set_ removes all previous transformations) d3d_transform_add_rotation_z(radtodeg(rot)) //rot is in radians, but the function takes degrees d3d_transform_add_translation(x,y,z) //Add the translation after rotation d3d_draw_ellipsoid(-1,-1,-1,1,1,1,texture,1,1,16) //Draw an ellipsoid with radius 1 at (0,0,0) d3d_transform_set_identity()Please don't be afraid to ask, I'd rather not run around looking for new topics with the same question
#6
Posted 11 February 2012 - 06:35 PM
//step event rotspd=hspeed/radius rot+=rotspd
Edited by TheSnidr, 11 February 2012 - 06:35 PM.
#7
Posted 11 February 2012 - 06:40 PM
THANK YOU! Thanks for all of your help! i got it working just fine~ If i wanted the spin to be double the speed its spinning now would i change the code to:Oops, my fault. Replace the rotation code with this:
//step event rotspd=hspeed/radius rot+=rotspd
rotspd=hspeed/radius*2 rot+=rotspd?
Well thanks for all of your help!
#8
Posted 11 February 2012 - 06:53 PM
Edited by TheSnidr, 11 February 2012 - 06:53 PM.
#9
Posted 11 February 2012 - 06:59 PM
view_angle[0]=180But that mirrors everything. This makes it hard to properly design levels. How do I fix this?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











