English 中文(简体)
Box2D : Check collision with the Joint?
原标题:

As shown in the image I have implemented "blob" by connecting Circle shapes with "Distance Joints".

(refering JBox2D ContantVolume joint).

http://oi52.tinypic.com/2pz08z9.jpg

Is it possible to check whether other objects (in above case,circle in Magenta color) collide with the "Distance Joint Line" ?

thanks in advance.

最佳回答

Not sure how youve exactly implementing it, but if you have the x,y cooridinates of the Joints then most of the hard work is done. My advice would be to use one line and assume that line starts at 0, and ends at say 5. therefore that line goes from 0=> y <=5 and x = 0;

Next you could write an abstract function that takes the parameters (x1,x2,y1,y2) Inside that function is where you calculate the line equation. This equation is what you test. for instance your balls x and y will hit that line and then your software will throw up an alert or whatever you want the ball to do when it crosses or hits.

If you do the function abstract you can then implement this on all of the joints. Plus if you can add the x stuff the way youve added the y and constantly have that function update you can effectively have that blob floating and rotating in your space.

Hope this helps

问题回答

暂无回答




相关问题
Collision Detection between Accelerating Spheres

I am writing a physics engine/simulator which incorporates 3D space flight, planetary/stellar gravitation, ship thrust and relativistic effects. So far, it is going very well, however, one thing that ...

Triangle - Triangle Intersection Test

I d like to know if there is out there some tutorial or guide to understand and implement a Triangle-Triangle intersection test in a 3D Environment. (i don t need to know precise where the ...

Simple Problem - Velocity and Collisions

Okay I m working on a Space sim and as most space sims I need to work out where the opponents ship will be (the 3d position) when my bullet reaches it. How do I calculate this from the velocity that ...

OO design and mirrored/duplicated methods

I m having an issue in OO design where I end up with duplicate code in 2 different classes. Here s what s going on: In this example, I want to detect collision between game objects. I have a base ...

avoiding geocode range collisions

I am in the process of extracting location entities ( Madison Square Garden , San Diego Zoo , etc.) from a large table of non-uniform location. I m trying to avoid multiple entities in my new table. ...

Bounding ellipse

I have been given an assignement for a graphics module, one part of which is to calculate the minimum bounding ellipse of a set of arbitrary shapes. The ellipse doesn t have to be axis aligned. This ...

circle-circle collision

I am going to develop a 2-d ball game where two balls (circles) collide. Now I have the problem with determining the colliding point (in fact, determining whether they are colliding in x-axis/y-axis)....

热门标签