简体   繁体   English

如何使用4x4变换矩阵动态更改对象的仿射变换。(16个元素的浮点数组)

[英]How to change the affine transform of an object dynamically using 4x4 transformation matrix.(float array of 16 elements)

Hi i need to transform an object dynamically in Unity iphone project using the float array of 16 which will be generated using ARToolKit. 嗨,我需要使用将使用ARToolKit生成的16浮点数组在Unity iphone项目中动态转换对象。 what is the api in unity 3d to change trasformation. 统一3d中的api可以用来改变变形。

Every GameObjec t in Unity has a Transform component attached to it. Unity中的每个GameObjec t都附加了一个Transform组件。 This can be accessed from other components using 可以使用以下方法从其他组件进行访问

Transform trans = gameObject.transform

This component has properties that can be used to alter the object's transformation. 该组件具有可用于更改对象转换的属性。 Among them are eg 其中有例如

position (Vector3)
rotation (Quaternion)
eulerAngles (Vector3)
localScale (Vector3)
...

You should be able to pull values out of your 4x4 matrix and apply them to these properties. 您应该能够将值从4x4矩阵中提取出来并将其应用于这些属性。 I don't think there's a way to directly apply a matrix to a GameObject. 我认为没有办法直接将矩阵应用于GameObject。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM