[fix] Rail Buttons now properly display in 2d side views (when the rocket is rotated
This commit is contained in:
parent
deed818fd3
commit
4ba395ac77
@ -18,7 +18,11 @@ public class RailButtonShapes extends RocketComponentShape {
|
|||||||
|
|
||||||
RailButton btn = (RailButton)component;
|
RailButton btn = (RailButton)component;
|
||||||
|
|
||||||
final double rotation_rad = btn.getAngleOffset();
|
final Coordinate instanceAbsoluteLocation = transformation.transform(Coordinate.ZERO);
|
||||||
|
final Coordinate unitOrientation = transformation.transform(new Coordinate(0,1,0));
|
||||||
|
|
||||||
|
final double view_rotation_rad = -Math.atan2(unitOrientation.y, unitOrientation.z) + Math.PI/2;
|
||||||
|
final double angle_offset_rad = btn.getAngleOffset();
|
||||||
final double baseHeight = btn.getStandoff();
|
final double baseHeight = btn.getStandoff();
|
||||||
final double innerHeight = btn.getInnerHeight();
|
final double innerHeight = btn.getInnerHeight();
|
||||||
final double flangeHeight = btn.getFlangeHeight();
|
final double flangeHeight = btn.getFlangeHeight();
|
||||||
@ -27,17 +31,15 @@ public class RailButtonShapes extends RocketComponentShape {
|
|||||||
final double innerDiameter = btn.getInnerDiameter();
|
final double innerDiameter = btn.getInnerDiameter();
|
||||||
final double innerRadius = innerDiameter/2;
|
final double innerRadius = innerDiameter/2;
|
||||||
|
|
||||||
final double sinr = Math.abs(Math.sin(rotation_rad));
|
final double sinr = Math.abs(Math.sin(angle_offset_rad + view_rotation_rad));
|
||||||
final double cosr = Math.cos(rotation_rad);
|
final double cosr = Math.cos(angle_offset_rad + view_rotation_rad);
|
||||||
final double baseHeightcos = baseHeight*cosr;
|
final double baseHeightcos = baseHeight*cosr;
|
||||||
final double innerHeightcos = innerHeight*cosr;
|
final double innerHeightcos = innerHeight*cosr;
|
||||||
final double flangeHeightcos = flangeHeight*cosr;
|
final double flangeHeightcos = flangeHeight*cosr;
|
||||||
|
|
||||||
final Coordinate instanceAbsoluteLocation = transformation.transform(Coordinate.ZERO);
|
// System.err.println(String.format("Generating Shapes for RailButtons..."));
|
||||||
|
// System.err.println(String.format(" @ %s", instanceAbsoluteLocation));
|
||||||
System.err.println(String.format("Generating Shapes for RailButtons..."));
|
// System.err.println(String.format(" angle: %f", view_rotation_rad));
|
||||||
System.err.println(String.format(" @ %s", instanceAbsoluteLocation));
|
|
||||||
|
|
||||||
|
|
||||||
Path2D.Double path = new Path2D.Double();
|
Path2D.Double path = new Path2D.Double();
|
||||||
{// central pillar
|
{// central pillar
|
||||||
|
Loading…
x
Reference in New Issue
Block a user