如何在Wheelcollider位置统一制作轮网格渲染器

时间:2016-03-15 22:34:28

标签: c# unity3d

我在弄清楚如何使轮子网格渲染对象与Wheelcollider对象匹配时遇到了一些麻烦。我搜索了互联网,并找到了一些不同版本的统一的简短答案。

这是我目前的代码:

使用UnityEngine;     使用System.Collections;

public class Position : MonoBehaviour {

    public WheelCollider wc;
    public Transform tf;

    // Use this for initialization
    void Start () {

        wc = GetComponent<WheelCollider> ();
        tf = GetComponent<Transform> ();

    }

    // Update is called once per frame
    void Update () {

        transform.position = new Vector3 (tf.transform.position.x + (wc.suspensionDistance * 100), tf.transform.position.y);

我知道如何使这项工作请帮忙!

2 个答案:

答案 0 :(得分:1)

我不相信您需要通过在层次结构中正确设置组件来对此解决方案进行编码。WheelCollider-MeshRenderer Hierarchy

比方说,例如,您的WheelCollider半径为1(意思是直径为2),以距离为单位,默认Transform.Scale为1,1,1。

我们还说你有一个想要使用的三维车轮网格。例如,我们会说你以一定比例导入了这个模型,这样当放置在具有1,1,1的默认Transform.Scale的场景中时,它占据的半径为0.5个距离单位(意味着直径为2)。

在这种情况下,你可以简单地在游戏对象上安装WheelCollider,并将该对象作为另一个附加网格的游戏对象的父。那个儿童游戏对象可以有一个2,2,2的Transform.scale,并且可以直观地匹配WheelCollider的Radius Gizmo。

对于您的解决方案,这些数字会有所不同。首先在场景中确定WheelCollider半径(视觉上)的大小,然后将其置于轮网格中并按顺序应用Transform.Scale

请注意,之后更改WheelCollider的半径不会缩放子游戏对象。

答案 1 :(得分:0)

OP 的代码和接受的答案都不正确。

OP 的代码很糟糕,因为它将轮子放在错误的位置(有时是对的,但通常是错误的);并且接受的答案是错误的,因为它说您不需要代码来实现这一点。

根据 Official Unity Tutorial for Wheel Colliders,您需要调用 Invalid depfile: /Volumes/ProjectsSSD/Flutter project/fixit_shop_flutter/.dart_tool/flutter_build/120221be81f1d8dd9be87e1783094685/kernel_snapshot.d Invalid depfile: /Volumes/ProjectsSSD/Flutter project/fixit_shop_flutter/.dart_tool/flutter_build/120221be81f1d8dd9be87e1783094685/kernel_snapshot.d /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/top_level.dart:1:8: Error: Not found: 'dart:html' import 'dart:html'; ^ /Users/vinnytwice/Developer/flutter/packages/flutter/lib/src/foundation/_platform_web.dart:5:8: Error: Not found: 'dart:html' import 'dart:html' as html; ^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.3/lib/js.dart:8:1: Error: Not found: 'dart:js' export 'dart:js' show allowInterop, allowInteropCaptureThis; ^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.3/lib/js_util.dart:8:1: Error: Not found: 'dart:js_util' export 'dart:js_util'; ^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/auth.dart:306:25: Error: The method 'allowInterop' isn't defined for the class 'Auth'. - 'Auth' is from 'package:firebase/src/auth.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/auth.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. var nextWrapper = allowInterop((firebase_interop.UserJsImpl user) { ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/auth.dart:310:26: Error: The method 'allowInterop' isn't defined for the class 'Auth'. - 'Auth' is from 'package:firebase/src/auth.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/auth.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. var errorWrapper = allowInterop((e) => _changeController.addError(e)); ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/auth.dart:340:25: Error: The method 'allowInterop' isn't defined for the class 'Auth'. - 'Auth' is from 'package:firebase/src/auth.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/auth.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. var nextWrapper = allowInterop((firebase_interop.UserJsImpl user) { ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/auth.dart:345:11: Error: The method 'allowInterop' isn't defined for the class 'Auth'. - 'Auth' is from 'package:firebase/src/auth.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/auth.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. allowInterop((e) => _idTokenChangedController.addError(e)); ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/database.dart:164:9: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'. - 'DatabaseReference' is from 'package:firebase/src/database.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/database.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. allowInterop((update) => jsify(transactionUpdate(dartify(update)))); ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/database.dart:166:26: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'. - 'DatabaseReference' is from 'package:firebase/src/database.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/database.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. var onCompleteWrap = allowInterop( ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/database.dart:301:24: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'. - 'Query' is from 'package:firebase/src/database.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/database.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. var callbackWrap = allowInterop((database_interop.DataSnapshotJsImpl data, ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/database.dart:325:30: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'. - 'Query' is from 'package:firebase/src/database.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/database.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. jsObject.once(eventType, allowInterop( ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/database.dart:402:22: Error: The method 'allowInterop' isn't defined for the class 'DataSnapshot'. - 'DataSnapshot' is from 'package:firebase/src/database.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/database.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. var actionWrap = allowInterop((d) => action(DataSnapshot.getInstance(d))); ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/messaging.dart:72:27: Error: The method 'allowInterop' isn't defined for the class 'Messaging'. - 'Messaging' is from 'package:firebase/src/messaging.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/messaging.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. final nextWrapper = allowInterop((payload) { ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/messaging.dart:75:28: Error: The method 'allowInterop' isn't defined for the class 'Messaging'. - 'Messaging' is from 'package:firebase/src/messaging.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/messaging.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. final errorWrapper = allowInterop((e) { ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/messaging.dart:87:27: Error: The method 'allowInterop' isn't defined for the class 'Messaging'. - 'Messaging' is from 'package:firebase/src/messaging.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/messaging.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. final nextWrapper = allowInterop((payload) { ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/messaging.dart:97:27: Error: The method 'allowInterop' isn't defined for the class 'Messaging'. - 'Messaging' is from 'package:firebase/src/messaging.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/messaging.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. final nextWrapper = allowInterop((_) => null); ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/messaging.dart:98:28: Error: The method 'allowInterop' isn't defined for the class 'Messaging'. - 'Messaging' is from 'package:firebase/src/messaging.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/messaging.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. final errorWrapper = allowInterop((e) { ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/storage.dart:320:11: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'. - 'UploadTask' is from 'package:firebase/src/storage.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/storage.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. allowInterop((storage_interop.UploadTaskSnapshotJsImpl data) { ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/storage.dart:324:26: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'. - 'UploadTask' is from 'package:firebase/src/storage.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/storage.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. var errorWrapper = allowInterop((e) => _changeController.addError(e)); ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/storage.dart:325:26: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'. - 'UploadTask' is from 'package:firebase/src/storage.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/storage.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. var onCompletion = allowInterop(() { ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/top_level.dart:196:7: Error: Method not found: 'hasProperty'. if (js.hasProperty(error, 'message')) { ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/top_level.dart:197:19: Error: Method not found: 'getProperty'. var message = js.getProperty(error, 'message'); ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:29:7: Error: Method not found: 'hasProperty'. if (util.hasProperty(jsObject, 'firestore') && ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:30:7: Error: Method not found: 'hasProperty'. util.hasProperty(jsObject, 'id') && ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:31:7: Error: Method not found: 'hasProperty'. util.hasProperty(jsObject, 'parent')) { ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:37:7: Error: Method not found: 'hasProperty'. if (util.hasProperty(jsObject, 'latitude') && ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:38:7: Error: Method not found: 'hasProperty'. util.hasProperty(jsObject, 'longitude') && ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:44:15: Error: Method not found: 'getProperty'. var proto = util.getProperty(jsObject, '__proto__'); ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:46:7: Error: Method not found: 'hasProperty'. if (util.hasProperty(proto, 'toDate') && ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:47:7: Error: Method not found: 'hasProperty'. util.hasProperty(proto, 'toMillis')) { ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:52:7: Error: Method not found: 'hasProperty'. if (util.hasProperty(proto, 'isEqual') && ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:53:7: Error: Method not found: 'hasProperty'. util.hasProperty(proto, 'toBase64')) { ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:67:24: Error: Method not found: 'getProperty'. map[key] = dartify(util.getProperty(jsObject, key)); ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:91:17: Error: Method not found: 'newObject'. var jsMap = util.newObject(); ^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:93:7: Error: Method not found: 'setProperty'. util.setProperty(jsMap, key, jsify(value)); ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:116:12: Error: Method not found: 'allowInterop'. return allowInterop(dartObject); ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:124:5: Error: Method not found: 'callMethod'. util.callMethod(jsObject, method, args); ^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:139:19: Error: Method not found: 'promiseToFuture'. value = await util.promiseToFuture(thenable); ^^^^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:141:9: Error: Method not found: 'hasProperty'. if (util.hasProperty(e, 'code')) { ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:152:27: Error: Method not found: 'allowInterop'. return PromiseJsImpl<S>(allowInterop(( ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:165:5: Error: Method not found: 'allowInterop'. allowInterop(c.completeError); ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:173:22: Error: Method not found: 'getProperty'. String get code => util.getProperty(_source, 'code'); ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:176:25: Error: Method not found: 'getProperty'. String get message => util.getProperty(_source, 'message'); ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:179:22: Error: Method not found: 'getProperty'. String get name => util.getProperty(_source, 'name'); ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:182:32: Error: Method not found: 'getProperty'. Object get serverResponse => util.getProperty(_source, 'serverResponse'); ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/utils.dart:185:23: Error: Method not found: 'getProperty'. String get stack => util.getProperty(_source, 'stack'); ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/firestore.dart:105:30: Error: The method 'allowInterop' isn't defined for the class 'Firestore'. - 'Firestore' is from 'package:firebase/src/firestore.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/firestore.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. var updateFunctionWrap = allowInterop((transaction) => ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/firestore.dart:306:11: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'. - 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/firestore.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. allowInterop((firestore_interop.DocumentSnapshotJsImpl snapshot) { ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/firestore.dart:310:26: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'. - 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/firestore.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. var errorWrapper = allowInterop((e) => controller.addError(e)); ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/firestore.dart:445:9: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'. - 'Query' is from 'package:firebase/src/firestore.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/firestore.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. allowInterop((firestore_interop.QuerySnapshotJsImpl snapshot) { ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/firestore.dart:449:24: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'. - 'Query' is from 'package:firebase/src/firestore.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/firestore.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. var errorWrapper = allowInterop((e) => controller.addError(e)); ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/firestore.dart:775:9: Error: The method 'allowInterop' isn't defined for the class 'QuerySnapshot'. - 'QuerySnapshot' is from 'package:firebase/src/firestore.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/firestore.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'. allowInterop((s) => callback(DocumentSnapshot.getInstance(s))); ^^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.3/lib/src/interop/js_interop.dart:17:7: Error: Method not found: 'hasProperty'. if (util.hasProperty(jsObject, 'toDateString')) { ^^^^^^^^^^^ /Users/vinnytwice/Developer/flutter/packages/flutter/lib/src/foundation/_platform_web.dart:23:41: Error: Getter not found: 'window'. final String navigatorPlatform = html.window.navigator.platform?.toLowerCase() ?? ''; ^^^^^^ /Users/vinnytwice/Developer/flutter/packages/flutter/lib/src/foundation/_platform_web.dart:43:12: Error: Getter not found: 'window'. if (html.window.matchMedia('only screen and (pointer: fine)').matches) { ^^^^^^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:1111:7: Info: Struct 'ENUMLOGFONTEX' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead. class ENUMLOGFONTEX extends Struct { ^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2835:7: Info: Struct 'BLUETOOTH_PIN_INFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead. class BLUETOOTH_PIN_INFO extends Struct { ^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2960:7: Info: Struct 'EXCEPINFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead. class EXCEPINFO extends Struct {} ^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2966:7: Info: Struct 'PROPERTYKEY' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead. class PROPERTYKEY extends Struct {} ^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2973:7: Info: Struct 'PROPVARIANT' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead. class PROPVARIANT extends Struct {} ^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2978:7: Info: Struct 'SAFEARRAY' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead. class SAFEARRAY extends Struct {} ^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2985:7: Info: Struct 'CLSID' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead. class CLSID extends Struct {} ^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2992:7: Info: Struct 'STATSTG' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead. class STATSTG extends Struct {} ^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2999:7: Info: Struct 'NLM_SIMULATED_PROFILE_INFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead. class NLM_SIMULATED_PROFILE_INFO extends Struct {} ^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf8.dart:23:7: Info: Struct 'Utf8' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead. class Utf8 extends Struct { ^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf16.dart:16:7: Info: Struct 'Utf16' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead. class Utf16 extends Struct { ^ /Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/allocation.dart:47:33: Info: Support for using non-constant type arguments 'T' in this FFI API is deprecated and will be removed in the next stable version of Dart. Rewrite the code to ensure that type arguments are compile time constants referring to a valid native type. final int totalSize = count * sizeOf<T>(); ^ Unhandled exception: FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml; message=StandardFileSystem only supports file:* and data:* URIs) #0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7) #1 asFileUri (package:vm/kernel_front_end.dart:599:37) #2 writeDepfile (package:vm/kernel_front_end.dart:738:21) <asynchronous suspension> #3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:554:9) <asynchronous suspension> #4 starter (package:flutter_frontend_server/server.dart:180:12) <asynchronous suspension> #5 main (file:///opt/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:13:24) <asynchronous suspension> FAILURE: Build failed with an exception. * Where: Script '/Users/vinnytwice/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 991 * What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'. > Process 'command '/Users/vinnytwice/Developer/flutter/bin/flutter'' finished with non-zero exit value 1 * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 26s Exception: Gradle task assembleDebug failed with exit code 1 来获取轮子的姿势,然后您需要将该姿势传递给渲染轮子的对象框架。 (这意味着 MeshRenderer 和 Collider do 需要在不同的对象上。) -- 单独的层次结构是行不通的,因为轮对撞机没有修改父级的变换(即它即使轮子跳动和旋转等,也将永远停留在 0,0,0 处)

不过,我确实推荐与已接受的答案中提出的相同的层次结构,因为它使事情更易于管理:

  • 车辆
    • WheelCollider1
      • WheelMeshRenderer1
    • WheelCollider2
      • WheelMeshRenderer2
    • 等等...

这是一个 MonoBehavior 脚本示例,如果您将其附加到每个 GetWorldPose 对象(根据上面的层次结构),该脚本将起作用:

WheelMeshRenderer#