Hi guys,
I've run into a problem with sprite placement when I rotate an object. I am not a math wizard, and I know I somehow need to flip the x,y,z coordinates to adjust when I rotate my object to 90 degrees.
0 degrees
90 degrees
Code for the 0 degree rotation.
function get_obj_screen_coords( obj as integer, corner ) // screen coords for sprites that follow objects
if corner = 1 //right uppercorner
x# = (GetObjectSizeMaxX(obj)-GetObjectSizeMinX(obj))/1.9
z# = (GetObjectSizeMaxZ(obj)- GetObjectSizeMinZ(obj))/2
y# = (GetObjectSizeMaxY(obj)- GetObjectSizeMinY(obj))
elseif corner = 2 //right lower
x# = (GetObjectSizeMaxX(obj)-GetObjectSizeMinX(obj))/2
z# = (GetObjectSizeMaxZ(obj)- GetObjectSizeMinZ(obj))/2
y# = 0
elseif corner = 3 //left upper
x# = (GetObjectSizeMaxX(obj)-GetObjectSizeMinX(obj))/-1.9
z# = (GetObjectSizeMaxZ(obj)- GetObjectSizeMinZ(obj))/2
y# = (GetObjectSizeMaxY(obj)- GetObjectSizeMinY(obj))
elseif corner = 4 //left lower
x# = (GetObjectSizeMaxX(obj)-GetObjectSizeMinX(obj))/-1.9
z# = (GetObjectSizeMaxZ(obj)- GetObjectSizeMinZ(obj))/-2
y# = 0
endif
house_obj_screen_coords[0] = GetScreenXFrom3D( getobjectx(obj)+x#, getobjecty(obj)+y#, getobjectz(obj)+z# )
house_obj_screen_coords[1] = GetScreenYFrom3D( getobjectx(obj)+x#, getobjecty(obj)+y#, getobjectz(obj)+z# )
endfunction
Appreciate any guidance.