Falco Engine 3.9.0.1 (beta)
Transform.cs
Go to the documentation of this file.
1using System;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5namespace FalcoEngine
6{
7 public class Transform : Component
8 {
9 internal Transform()
10 {
11
12 }
13
14 private IntPtr native_ptr = (IntPtr)0;
15
16 /*----------- PUBLIC ------------*/
17
22 {
23 get
24 {
25 INTERNAL_get_position(out Vector3 value);
26 return value;
27 }
28 set
29 {
30 INTERNAL_set_position(ref value);
31 }
32 }
33
38 {
39 get
40 {
41 INTERNAL_get_rotation(out Quaternion value);
42 return value;
43 }
44 set
45 {
46 INTERNAL_set_rotation(ref value);
47 }
48 }
49
54 {
55 get
56 {
57 INTERNAL_get_scale(out Vector3 value);
58 return value;
59 }
60 set
61 {
62 INTERNAL_set_scale(ref value);
63 }
64 }
65
70 {
71 get
72 {
73 INTERNAL_get_local_position(out Vector3 value);
74 return value;
75 }
76 set
77 {
78 INTERNAL_set_local_position(ref value);
79 }
80 }
81
86 {
87 get
88 {
89 INTERNAL_get_local_rotation(out Quaternion value);
90 return value;
91 }
92 set
93 {
94 INTERNAL_set_local_rotation(ref value);
95 }
96 }
97
102 {
103 get
104 {
105 INTERNAL_get_local_scale(out Vector3 value);
106 return value;
107 }
108 set
109 {
110 INTERNAL_set_local_scale(ref value);
111 }
112 }
113
118 {
119 get
120 {
121 INTERNAL_get_forward(out Vector3 value);
122 return value;
123 }
124 }
125
129 public Vector3 up
130 {
131 get
132 {
133 INTERNAL_get_up(out Vector3 value);
134 return value;
135 }
136 }
137
142 {
143 get
144 {
145 INTERNAL_get_left(out Vector3 value);
146 return value;
147 }
148 }
149
154 {
155 get
156 {
157 INTERNAL_get_right(out Vector3 value);
158 return value;
159 }
160 }
161
165 public int childCount { [MethodImpl(MethodImplOptions.InternalCall)] get; }
166
170 public Transform parent { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }
171
177 public Transform GetChild(int index)
178 {
179 return INTERNAL_get_child(index);
180 }
181
187 public Transform FindChild(string name)
188 {
189 return INTERNAL_find_child(name);
190 }
191
197 {
198 INTERNAL_TransformDirection(ref direction, out Vector3 ret);
199 return ret;
200 }
201
208 public Vector3 TransformDirection(float x, float y, float z)
209 {
210 return TransformDirection(new Vector3(x, y, z));
211 }
212
218 {
219 INTERNAL_InverseTransformDirection(ref direction, out Vector3 ret);
220 return ret;
221 }
222
229 public Vector3 InverseTransformDirection(float x, float y, float z)
230 {
231 return InverseTransformDirection(new Vector3(x, y, z));
232 }
233
239 {
240 INTERNAL_TransformPoint(ref position, out Vector3 ret);
241 return ret;
242 }
243
250 public Vector3 TransformPoint(float x, float y, float z)
251 {
252 return TransformPoint(new Vector3(x, y, z));
253 }
254
260 {
261 INTERNAL_InverseTransformPoint(ref position, out Vector3 ret);
262 return ret;
263 }
264
271 public Vector3 InverseTransformPoint(float x, float y, float z)
272 {
273 return InverseTransformPoint(new Vector3(x, y, z));
274 }
275
276 /*----------- INTERNAL CALLS ------------*/
277
278 [MethodImpl(MethodImplOptions.InternalCall)]
279 private extern void INTERNAL_get_position(out Vector3 value);
280
281 [MethodImpl(MethodImplOptions.InternalCall)]
282 private extern void INTERNAL_set_position(ref Vector3 value);
283
284 [MethodImpl(MethodImplOptions.InternalCall)]
285 private extern void INTERNAL_get_scale(out Vector3 value);
286
287 [MethodImpl(MethodImplOptions.InternalCall)]
288 private extern void INTERNAL_set_scale(ref Vector3 value);
289
290 [MethodImpl(MethodImplOptions.InternalCall)]
291 private extern void INTERNAL_get_rotation(out Quaternion value);
292
293 [MethodImpl(MethodImplOptions.InternalCall)]
294 private extern void INTERNAL_set_rotation(ref Quaternion value);
295
296 [MethodImpl(MethodImplOptions.InternalCall)]
297 private extern void INTERNAL_get_local_position(out Vector3 value);
298
299 [MethodImpl(MethodImplOptions.InternalCall)]
300 private extern void INTERNAL_set_local_position(ref Vector3 value);
301
302 [MethodImpl(MethodImplOptions.InternalCall)]
303 private extern void INTERNAL_get_local_rotation(out Quaternion value);
304
305 [MethodImpl(MethodImplOptions.InternalCall)]
306 private extern void INTERNAL_set_local_rotation(ref Quaternion value);
307
308 [MethodImpl(MethodImplOptions.InternalCall)]
309 private extern void INTERNAL_get_local_scale(out Vector3 value);
310
311 [MethodImpl(MethodImplOptions.InternalCall)]
312 private extern void INTERNAL_set_local_scale(ref Vector3 value);
313
314 [MethodImpl(MethodImplOptions.InternalCall)]
315 private extern Transform INTERNAL_get_child(int index);
316
317 [MethodImpl(MethodImplOptions.InternalCall)]
318 private extern Transform INTERNAL_find_child(string name);
319
320 [MethodImpl(MethodImplOptions.InternalCall)]
321 private extern void INTERNAL_get_forward(out Vector3 value);
322
323 [MethodImpl(MethodImplOptions.InternalCall)]
324 private extern void INTERNAL_get_up(out Vector3 value);
325
326 [MethodImpl(MethodImplOptions.InternalCall)]
327 private extern void INTERNAL_get_left(out Vector3 value);
328
329 [MethodImpl(MethodImplOptions.InternalCall)]
330 private extern void INTERNAL_get_right(out Vector3 value);
331
332 [MethodImpl(MethodImplOptions.InternalCall)]
333 private extern void INTERNAL_TransformDirection(ref Vector3 direction, out Vector3 ret);
334
335 [MethodImpl(MethodImplOptions.InternalCall)]
336 private extern void INTERNAL_InverseTransformDirection(ref Vector3 direction, out Vector3 ret);
337
338 [MethodImpl(MethodImplOptions.InternalCall)]
339 private extern void INTERNAL_TransformPoint(ref Vector3 position, out Vector3 ret);
340
341 [MethodImpl(MethodImplOptions.InternalCall)]
342 private extern void INTERNAL_InverseTransformPoint(ref Vector3 position, out Vector3 ret);
343 }
344}
Vector3 InverseTransformDirection(Vector3 direction)
Definition: Transform.cs:217
Quaternion localRotation
The rotation of the transform relative to the transform rotation of the parent
Definition: Transform.cs:86
Vector3 right
The red axis of the transform in world space
Definition: Transform.cs:154
Quaternion rotation
A Quaternion that stores the rotation of the transform in world space
Definition: Transform.cs:38
Vector3 up
The green axis of the transform in world space
Definition: Transform.cs:130
Vector3 TransformPoint(Vector3 position)
Definition: Transform.cs:238
Vector3 TransformDirection(float x, float y, float z)
Definition: Transform.cs:208
Vector3 forward
Returns a normalized vector representing the blue axis of the transform in world space
Definition: Transform.cs:118
Vector3 position
The world space position of the transform
Definition: Transform.cs:22
Transform GetChild(int index)
Returns a transform child by index
Definition: Transform.cs:177
Vector3 TransformPoint(float x, float y, float z)
Definition: Transform.cs:250
Vector3 TransformDirection(Vector3 direction)
Definition: Transform.cs:196
Transform FindChild(string name)
Finds a child by name and returns it
Definition: Transform.cs:187
Vector3 InverseTransformPoint(Vector3 position)
Definition: Transform.cs:259
Vector3 scale
The global scale of the object
Definition: Transform.cs:54
Vector3 left
The negative red axis of the transform in world space
Definition: Transform.cs:142
Vector3 localScale
The scale of the transform relative to the GameObjects parent.
Definition: Transform.cs:102
Vector3 InverseTransformDirection(float x, float y, float z)
Definition: Transform.cs:229
int childCount
The number of children the transform has
Definition: Transform.cs:165
Vector3 InverseTransformPoint(float x, float y, float z)
Definition: Transform.cs:271
Vector3 localPosition
Position of the transform relative to the parent transform.
Definition: Transform.cs:70
Transform parent
The parent of the transform
Definition: Transform.cs:170