Nick der mit hut
Member
Hello, I have made a project in which the world can be rotated 90° Left or Right by pressing the Left and Right Arrowkeys.
I want the objects to stay at their positions so they have to rotate/orbit arround the center point. This does work with the big red house and the world itself. I achieved this with.
Create event:
__radius = point_distance(center.x, center.y, x, y)
__dir = point_direction(center.x,center.y,x,y)
Step event:
__theta = global.camrot; // camrot = camera rotation. This is what changes -/+ 90° when arrowkey is pushed
x = center.x + lengthdir_x(__radius,__dir + __theta )
y = center.y + lengthdir_y(__radius,__dir + __theta) //I could just put global.camrot instead of theta but oh well
Houses or Not Moving objects are working fine. But the player for example an object where the dir and radius are chaning/updating as long as the world is not rotating is jumping about in weird 90° increments. You'll see in the video what I mean. The player is not able to move as the world is rotating and I want him to behave like the other things (like The World and the big red house).
Here is the Project
http://www.mediafire.com/file/mp5t837vscq2azs/Testing_3d_Rotating_Camera.zip/file
I want the objects to stay at their positions so they have to rotate/orbit arround the center point. This does work with the big red house and the world itself. I achieved this with.
Create event:
__radius = point_distance(center.x, center.y, x, y)
__dir = point_direction(center.x,center.y,x,y)
Step event:
__theta = global.camrot; // camrot = camera rotation. This is what changes -/+ 90° when arrowkey is pushed
x = center.x + lengthdir_x(__radius,__dir + __theta )
y = center.y + lengthdir_y(__radius,__dir + __theta) //I could just put global.camrot instead of theta but oh well
Houses or Not Moving objects are working fine. But the player for example an object where the dir and radius are chaning/updating as long as the world is not rotating is jumping about in weird 90° increments. You'll see in the video what I mean. The player is not able to move as the world is rotating and I want him to behave like the other things (like The World and the big red house).
Here is the Project
http://www.mediafire.com/file/mp5t837vscq2azs/Testing_3d_Rotating_Camera.zip/file