【发布时间】:2018-11-02 14:33:07
【问题描述】:
我需要设置像铰链关节这样的可配置关节,它应该像金属梁一样将玩家与物体连接起来,但问题是当我设置锚点并限制它向前飞到的轴时玩家不会立即停止物体然后下降到极限,所以我的光束将他的尺寸从短变长,这很糟糕。你能帮帮我吗?
这里是代码sn-p:
playerJoint.connectedAnchor = anchor.transform.position;
SoftJointLimit limit = new SoftJointLimit();
limit.limit = Vector3.Distance(anchor.transform.position, transform.position);
playerJoint.linearLimit = limit;
playerJoint.yMotion = ConfigurableJointMotion.Limited;
playerJoint.xMotion = ConfigurableJointMotion.Limited;
然后当玩家松开按钮时,会运行以下代码:
playerJoint.yMotion = ConfigurableJointMotion.Free;
playerJoint.xMotion = ConfigurableJointMotion.Free;
提前谢谢你。
【问题讨论】:
标签: c# unity3d game-physics