File tree 2 files changed +72
-0
lines changed
crates/bevy_transform/src/components
2 files changed +72
-0
lines changed Original file line number Diff line number Diff line change @@ -118,18 +118,54 @@ impl GlobalTransform {
118
118
self . rotation * Vec3 :: X
119
119
}
120
120
121
+ /// Equivalent to -local_x()
122
+ #[ inline]
123
+ pub fn left ( & self ) -> Vec3 {
124
+ -self . local_x ( )
125
+ }
126
+
127
+ /// Equivalent to local_x()
128
+ #[ inline]
129
+ pub fn right ( & self ) -> Vec3 {
130
+ self . local_x ( )
131
+ }
132
+
121
133
/// Get the unit vector in the local y direction
122
134
#[ inline]
123
135
pub fn local_y ( & self ) -> Vec3 {
124
136
self . rotation * Vec3 :: Y
125
137
}
126
138
139
+ /// Equivalent to local_y()
140
+ #[ inline]
141
+ pub fn up ( & self ) -> Vec3 {
142
+ self . local_y ( )
143
+ }
144
+
145
+ /// Equivalent to -local_y()
146
+ #[ inline]
147
+ pub fn down ( & self ) -> Vec3 {
148
+ -self . local_y ( )
149
+ }
150
+
127
151
/// Get the unit vector in the local z direction
128
152
#[ inline]
129
153
pub fn local_z ( & self ) -> Vec3 {
130
154
self . rotation * Vec3 :: Z
131
155
}
132
156
157
+ /// Equivalent to -local_z()
158
+ #[ inline]
159
+ pub fn forward ( & self ) -> Vec3 {
160
+ -self . local_z ( )
161
+ }
162
+
163
+ /// Equivalent to local_z()
164
+ #[ inline]
165
+ pub fn back ( & self ) -> Vec3 {
166
+ self . local_z ( )
167
+ }
168
+
133
169
#[ doc( hidden) ]
134
170
#[ inline]
135
171
pub fn rotate ( & mut self , rotation : Quat ) {
Original file line number Diff line number Diff line change @@ -130,18 +130,54 @@ impl Transform {
130
130
self . rotation * Vec3 :: X
131
131
}
132
132
133
+ /// Equivalent to -local_x()
134
+ #[ inline]
135
+ pub fn left ( & self ) -> Vec3 {
136
+ -self . local_x ( )
137
+ }
138
+
139
+ /// Equivalent to local_x()
140
+ #[ inline]
141
+ pub fn right ( & self ) -> Vec3 {
142
+ self . local_x ( )
143
+ }
144
+
133
145
/// Get the unit vector in the local y direction.
134
146
#[ inline]
135
147
pub fn local_y ( & self ) -> Vec3 {
136
148
self . rotation * Vec3 :: Y
137
149
}
138
150
151
+ /// Equivalent to local_y()
152
+ #[ inline]
153
+ pub fn up ( & self ) -> Vec3 {
154
+ self . local_y ( )
155
+ }
156
+
157
+ /// Equivalent to -local_y()
158
+ #[ inline]
159
+ pub fn down ( & self ) -> Vec3 {
160
+ -self . local_y ( )
161
+ }
162
+
139
163
/// Get the unit vector in the local z direction.
140
164
#[ inline]
141
165
pub fn local_z ( & self ) -> Vec3 {
142
166
self . rotation * Vec3 :: Z
143
167
}
144
168
169
+ /// Equivalent to -local_z()
170
+ #[ inline]
171
+ pub fn forward ( & self ) -> Vec3 {
172
+ -self . local_z ( )
173
+ }
174
+
175
+ /// Equivalent to local_z()
176
+ #[ inline]
177
+ pub fn back ( & self ) -> Vec3 {
178
+ self . local_z ( )
179
+ }
180
+
145
181
/// Rotates the transform by the given rotation.
146
182
#[ inline]
147
183
pub fn rotate ( & mut self , rotation : Quat ) {
You can’t perform that action at this time.
0 commit comments