English 中文(简体)
我需要某种硬体碰撞探测引擎,用于安的安乐。
原标题:I need some sort of rigid body collision detection engine for Android

我曾试图让自己去安乐,但我失败了。 我用硬体碰撞探测来说,基本上存在隔离墙,一旦参与者触动隔离墙,它就无法走下去。 我曾尝试使用Box2D、Emini发动机、PPhys2D、Phys2D,并且他们要么拥有足够的辅导,要么真正复杂。 我写了这番话,用我正常的 Java游戏进行:

//package
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class DCDE {
int plx, ply, obx, oby, obw, obh, plw, plh;
Rectangle north;
Rectangle east;
Rectangle south;
Rectangle west;
boolean debug=true;
public void debug(Graphics g)
{
    Graphics2D g2 = (Graphics2D)g;
    if(debug)
    {
        if(!(north==null)&&!(east==null)&&!(south==null)&&!(west==null)){
            g2.setColor(Color.YELLOW);
            g2.draw(north);
            g2.draw(east);
            g2.draw(south);
            g2.draw(west);
            g2.fill(north);
            g2.fill(east);
            g2.fill(south);
            g2.fill(west);
        }
    }
}
public void detect(int plxj, int plyj, int obxj, int obyj, int obwj, int obhj, int plwj, int plhj)
{
    plx=plxj;
    ply=plyj;
    obx=obxj;
    oby=obyj;
    obw=obwj;
    obh=obhj;
    plw=plwj;
    plh=plhj;
    Rectangle playr = new Rectangle(plx, ply, plw, plh);
    Rectangle objr = new Rectangle(obx, oby, obw, obh);
    north = new Rectangle((obx), (oby-1), obw, 1);
    east = new Rectangle((obx+obw), (oby), 1, obh);
    south = new Rectangle((obx), (oby+obh)+1, obw, 1);
    west = new Rectangle((obx-1), oby, 1, obh);
    if(playr.intersects(north)){
        ply=(oby-plh-1);
        if(debug)System.out.println("NORTH");
    }
    if(playr.intersects(east)){
        plx=(obx+obw+1);
        if(debug)System.out.println("EAST");
    }
    if(playr.intersects(south)){
        ply=(oby+obh+1);
        if(debug)System.out.println("SOUTH");
    }
    if(playr.intersects(west)){
        plx=(obx-plw-1);
        if(debug)System.out.println("WEST");
    }
}
}

这在电脑-java游戏上课了罚款,但现在我需要上述东西,而需要的是roid。 因此,是否为碰撞探测而投入某种发动机JUST,而不是整个重力,或者我能使用某种容易的数学方法?

提前感谢。

问题回答

为什么不只使用已经在甲状腺上运行的图像发动机,例如 Unity 。 他们已经ve着其他冰箱的 built。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签