本文整理汇总了Java中org.jbox2d.collision.RayCastInput.set方法的典型用法代码示例。如果您正苦于以下问题:Java RayCastInput.set方法的具体用法?Java RayCastInput.set怎么用?Java RayCastInput.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jbox2d.collision.RayCastInput
的用法示例。
在下文中一共展示了RayCastInput.set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RayCast
import org.jbox2d.collision.RayCastInput; //导入方法依赖的package包/类
public void RayCast() {
m_rayActor = null;
RayCastInput input = new RayCastInput();
input.set(m_rayCastInput);
// Ray cast against the dynamic tree.
m_tree.raycast(this, input);
// Brute force ray cast.
Actor bruteActor = null;
RayCastOutput bruteOutput = new RayCastOutput();
for (int i = 0; i < e_actorCount; ++i) {
if (m_actors[i].proxyId == -1) {
continue;
}
RayCastOutput output = new RayCastOutput();
boolean hit = m_actors[i].aabb.raycast(output, input,
getWorld().getPool());
if (hit) {
bruteActor = m_actors[i];
bruteOutput = output;
input.maxFraction = output.fraction;
}
}
if (bruteActor != null) {
if(MathUtils.abs(bruteOutput.fraction
- m_rayCastOutput.fraction) > Settings.EPSILON) {
System.out.println("wrong!");
assert (MathUtils.abs(bruteOutput.fraction
- m_rayCastOutput.fraction) <= 20 * Settings.EPSILON);
}
}
}
示例2: RayCast
import org.jbox2d.collision.RayCastInput; //导入方法依赖的package包/类
public void RayCast() {
m_rayActor = null;
RayCastInput input = new RayCastInput();
input.set(m_rayCastInput);
// Ray cast against the dynamic tree.
m_tree.raycast(this, input);
// Brute force ray cast.
Actor bruteActor = null;
RayCastOutput bruteOutput = new RayCastOutput();
for (int i = 0; i < e_actorCount; ++i) {
if (m_actors[i].proxyId == null) {
continue;
}
RayCastOutput output = new RayCastOutput();
boolean hit = m_actors[i].aabb.raycast(output, input,
getWorld().getPool());
if (hit) {
bruteActor = m_actors[i];
bruteOutput = output;
input.maxFraction = output.fraction;
//input.set(m_rayCastInput);
}
}
if (bruteActor != null) {
assert (MathUtils.abs(bruteOutput.fraction
- m_rayCastOutput.fraction) <= Settings.EPSILON);
}
}