在投掷刚体之前如何检查刚体将落在何处? [英] How to check where rigid body will land before throwing it?
问题描述
我想要一门大炮,当玩家调整用来发射它的力量时,我想显示炮弹会落在哪里.
I want to have a cannon and as the player adjusts the force applied to fire it, I'd like to show where cannonball will land.
看起来我想要的公式在这里:http://en.wikipedia.org/wiki/Trajectory#Uniform_gravity.2C_no_drag_or_wind 但是我想知道这是否是 unity 可以在不编写公式的情况下为我提供的东西(因为它显然已经在 unity 中使用了),一个原因是我不不想犯一个错误,即当炮弹实际发射时,我的计算与统一性不符.
Looks like the formula for what I want is here: http://en.wikipedia.org/wiki/Trajectory#Uniform_gravity.2C_no_drag_or_wind however I'd like to know if this is something that unity can provide for me without coding the formula (as it's obviously already used in unity), one reason being i don't want to make a mistake where my calculation won't correspond to unity when the cannonball is actually fired.
推荐答案
不幸的是,Unity 的物理特性不是确定性的.我见过一些团队试图实现这样的东西.这需要很多时间,通常最后会采取以下方法之一:
Unfortunately, Unity's physics isn't deterministic. I've seen a few teams trying to implement something like this. It takes a lot of time, and usually, one of the following approaches is taken in the end:
- 使用您自己定制的确定性物理——但这通常非常耗时,并且需要对整个项目进行大量更改
- 使用特殊代码近似 Unity 的物理 - 但它不精确并且可能与最终结果不同
- 加速 Unity 物理,启动具有相同参数的对象的隐形克隆,然后显示它所采取的轨迹 - 仍然需要一些时间来计算.询问游戏设计师他们是否同意每次玩家移动大炮后出现的动画"轨迹——当然,动画"是隐形炮弹克隆体的实际移动.
这篇关于在投掷刚体之前如何检查刚体将落在何处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!