File tree Expand file tree Collapse file tree 7 files changed +10
-15
lines changed
Expand file tree Collapse file tree 7 files changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ class Shape implements IProxy {
148148
149149 public function set_parent (? frame : Frame2 ) {
150150 parent_frame = frame ;
151- if ( parent_frame != null ) sync ();
151+ sync ();
152152 }
153153 /**
154154 * Returns an AABB `Rect` representing the bounds of the `Shape`.
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ class Circle extends Shape implements IPooled {
7777 var pos = parent_frame .transformFrom (get_local_position ());
7878 _x = pos .x ;
7979 _y = pos .y ;
80- _rotation = parent_frame .angleDegrees . degToRad () + local_rotation ;
80+ _rotation = parent_frame .angleDegrees + local_rotation ;
8181 }
8282 else {
8383 _x = local_x ;
Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ class Polygon extends Shape implements IPooled {
156156 var pos = parent_frame .transformFrom (get_local_position ());
157157 _x = pos .x ;
158158 _y = pos .y ;
159- _rotation = parent_frame .angleDegrees . degToRad () + local_rotation ;
159+ _rotation = parent_frame .angleDegrees + local_rotation ;
160160 }
161161 else {
162162 _x = local_x ;
@@ -232,11 +232,11 @@ class Polygon extends Shape implements IPooled {
232232 var pos = get_local_position ();
233233 vertices .resize (0 );
234234 local_frame .offset .set (pos .x , pos .y );
235- local_frame .angleDegrees = rotation ;
235+ local_frame .angleDegrees = local_rotation ;
236+ if (parent_frame != null ) local_frame = parent_frame .concat (local_frame );
236237 for (i in 0 ... count ) {
237238 if (local_vertices [i ] == null ) continue ;
238- if (parent_frame == null ) vertices [i ] = local_frame .transformFrom (local_vertices [i ].clone ());
239- else vertices [i ] = parent_frame .concat (local_frame ).transformFrom (local_vertices [i ].clone ());
239+ vertices [i ] = local_frame .transformFrom (local_vertices [i ].clone ());
240240 }
241241 }
242242 /**
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ class Rect extends Shape implements IPooled {
130130 var pos = parent_frame .transformFrom (get_local_position ());
131131 _x = pos .x ;
132132 _y = pos .y ;
133- _rotation = parent_frame .angleDegrees . degToRad () + local_rotation ;
133+ _rotation = parent_frame .angleDegrees + local_rotation ;
134134 }
135135 else {
136136 _x = local_x ;
Original file line number Diff line number Diff line change 55 "description" : " Simple Physics Library written in Haxe" ,
66 "contributors" : [" austineast" ],
77 "url" : " https://austineast.dev/echo" ,
8- "releasenote" : " TileMap Collider Generation " ,
9- "version" : " 1.2.0 " ,
8+ "releasenote" : " relative shape rotation fixes " ,
9+ "version" : " 1.2.1 " ,
1010 "dependencies" : {
1111 "hxmath" : " "
1212 }
Original file line number Diff line number Diff line change @@ -18,11 +18,6 @@ class MultiShapeState extends BaseState {
1818 // rotational_velocity: 25,
1919 rotation : Random .range (0 , 360 ),
2020 shapes : [
21- // {
22- // type: RECT,
23- // width: 32,
24- // radius: 16
25- // },
2621 {
2722 type : i % 2 == 0 ? CIRCLE : RECT ,
2823 offset_x : 16 ,
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ class TileMapState extends BaseState {
8282
8383 // Reset any off-screen Bodies
8484 world .for_each ((member ) -> {
85- if (offscreen (member , world )) {
85+ if (member != cursor && offscreen (member , world )) {
8686 member .velocity .set (0 , 0 );
8787 member .set_position (Random .range (0 , world .width ), 0 );
8888 }
You can’t perform that action at this time.
0 commit comments